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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I just created a combo box on my ma

Status
Not open for further replies.

zachsiue

Technical User
Jan 9, 2003
20
US
I just created a combo box on my main form that launches different forms depending on which item is selected. I would like to "carry" some of the information on the main form onto the form created when I selected the combo box option. What would be the best way to do this?

Here is the code that is implemented:



Private Sub Action_AfterUpdate()
Select Case [Action]
Case "Evaluate"
DoCmd.OpenForm "Evaluate"

Case "SETUP"
DoCmd.OpenForm "SETUP SUBFORM"

End Select

End Sub

I want the ID value from my main form to also be inclued in both of these forms when they are opened.

Thank you,
Zach
 
Zach,

You have many options. Look into help for OpenArgs. You could also just refer to the control on the main form that holds the value you want (forms!MainForm!Control) from the opened form. Or you could make you code pick up that value and put it in the appropriate control on the opened form.

Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks

Take a look at the Developers' section of the site for some helpful fundamentals.
 
I would agree, using the OpenArgs would be the way to go. But if you have several values that you need to pass, try using public variables and in the form your opening load the variables into the text boxes/variables in the On Load event. BTW, to simplify your code try this:

##########################################################

Private Sub Action_AfterUpdate()
Dim OpenArgs as Variant
OpenArgs=??? whatever value ???

DoCmd.OpenForm [Action].Column(0),acNormal,,,,,OpenArgs
End Sub

##########################################################

Set the [Action].Column(?) to whatever column contains the form name in the combo box.

Doing it like this will reduce select case statements...


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top