Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variables between forms

Status
Not open for further replies.

jmorlock

Programmer
Apr 25, 2003
46
US
How do you pass variables from one form to another. When i click the enter button i want to send the client number to the form that opens so that i can enter data and do calculations and update the correct client.
 
You could use the OpenArgs parameter for the form. When you open the form, use something like:

DoCmd.OpenForm "frmMyForm", acNormal, , , , , myVariable

Then you would have to check for the OpenArgs parameter in the Open event for frmMyForm and handle it as necessary.
Example:

If IsNull(Forms!frmMyForm.OpenArgs) Then
'no parameter passed, do error handling
Else
myNewVariable = Forms!frmMyForm.OpenArgs
End If

 
Right. But, if the first form is always going to be open when the second form is open, you could also just refer directly to the first form.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top