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!

OpenArgs passing null to popupform

Status
Not open for further replies.

lastout

Programmer
Apr 12, 2002
84
US
I'm having a problem getting the value in my combobox (a new value being added to the list with NotInList event) to pass to the popup form that is opened when the NotInList event fires. The command is:

DoCmd.OpenForm "frmPopUpAgent",,,,acFormAdd,acDialog,me.cmbAgentID.Column(1)

Although there is a value in the combobox when the popup form is opened, it doesn't appear in the popup. If I put in a literal value, like "George" in the OpenArgs part of the DoCmd.OpenForm, George will appear where it's supposed to in the popup. Knowing that, I suspect that somehow cmbAgentID is still set to a null value even though the cmbAgentID is dirty. Just before the DoCmd.OpenForm line, I have Response = acDataErrAdded.

Anyone have a solution for this, or some advice?

THANK YOU! lastout (the game's not over till it's over)
 
It sounds like NotInList runs before the combobox is updated. Therefore, the combobox would still have the old value - Null in this case. Help shows that NotInList has a parameter called NewData, which is the new text in the combobox. This is what you should pass to DoCmd.OpenForm in place of Me.cmbAgentID.

DoCmd.OpenForm "frmPopUpAgent",,,,acFormAdd,acDialog,NewData
 
Another alternative would be to use the AfterUpdate event, but that doesn't sound like the alternative you need.
 
That did it perfectly - THANKS so much! lastout (the game's not over till it's over)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top