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

pass a value from one form to another

Status
Not open for further replies.

lastout

Programmer
Apr 12, 2002
84
US
I've read a number of posts about this but still can't seem to make it work. On the NotInList event in one form, I have a DoCmd that opens another form for the user to fill in a new value (a name) and its corresponding data. I want to use OpenArgs to pass the new name to the FirstName control on the second form (a popup). The combobox that contains the NotInList event procedure is bound to the ID field for the new name, not the name itself. The ID field is autonumber so I don't need to pass the number itself because it will be automatically assigned. What I want to pass is the name. So far this is the code:

DoCmd.OpenForm "frmPopUpAgent",,,,acFormAdd, acDialog, me.cmbAgentID

I'm not sure how to get around the AgentID to the name from the combobox that shows not the ID itself, but the name. How can I get the firstname to fill in automatically when the form is loaded? I know I need the OpenArgs of the DoCmd.OpenForm object to contain the name value and then have the OnLoad event of the popupform pick up the value. How to do this?

Much THANKS! lastout (the game's not over till it's over)
 
If your combobox has 2 columns id and name, then the position of the first column the id is zero the position of the second column is 1 etc...

me.cmbAgentID.column(1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top