Best practice for passing data btwn forms

stormin_norm

Registered User.
Local time
Today, 01:53
Joined
Apr 23, 2003
Messages
213
I am building an application where one form (form1) will drive the data in the next form (form2).

i.e.
Have a form which looks up the customer, then pull up a detailed form based on the results of form1. Probably going to make it a popup.

I have reviewed postings, and read a few books. I found the Access Cookbook to be fantastic. But still curious what is easiest to code?

And what would be a good technique if I wish re-use form 1 to call form2, form3,form4,form5 either through command buttons or other technique.
I was thinking of using global variables and calling set and get functions, but I'm sure using the [Forms]![frmForm1].[lb...... should work okay.

Now an additional question- Whenever form2,form3 or other forms get focus, shouldn't then requery what the results are on form1?

Thanks in advance for any advice!!
Norm.
 
Easiest way is to use the [Where] option of the openform method. Look at vba help for openform. In your case, the statement would be something like

docmd.openform "frmForm2",,,"[CustomerID] = " & Forms!frmForm1!CustomerID, ,acDialog

this will open the popup form with only the selected customers related records and give this form exclusive focus so that you could not select another form until the popup one was closed.
 

Users who are viewing this thread

Back
Top Bottom