Specific Data to Follow to Other Forms

S

swlaw

I have a form called New Project, all new projects will be entered into this
form. What I would like to do is when I enter a new project, I would like to
be able to click a button and it take me to another form (Start Up) and the
same project number that I just entered into New Project, I would like to
have appear in the
Start Up form in the Project Number box.
The botton function is not the issue, it is having that new project number
appear in the forms, there will be four forms that I will need to enter data
that corresponds to the new project number.
 
K

KenSheridan via AccessMonster.com

You can pass the value to the other form via the OpenArgs mechanism:

In the Click event procedure of the button on the New Project form put:

' first ensure current record is saved
Me.Dirty = False

' open start up form in dialogue mode
' and pass project number to it
DoCmd.OpenForm "Start Up", _
WindowMode:= acDialog, _
OpenArgs:=Me.[Project Number]

Then in the Open event procedure of the Start Up form put:

If Not IsNull(Me.OpenArgs) Then
Me.[Project Number].DefaultValue = """" & Me.OpenArgs & """"
End If

By opening the start up form in dialogue mode this forces the user to close
that form before they can return to the new project form. Note that the
DefaultValue property is a string expression regardless of the data type of
the field in question, so should be wrapped in quotes characters as above.

Do similarly for the other forms.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top