Requery Combo Box but Keep Selection

meadows43

Registered User.
Local time
Today, 13:04
Joined
Jan 6, 2003
Messages
54
I have a form called "New Account" that opens another form called "New SAM" if a new value is entered in a certain combo box on the first form. After the second form closes, I requery the combo box on the first form, but I need the original value that the user entered (which has been added to the table underlying the combo box after the user hits OK on the second form) to be selected in the combo box. What's the best way to set the selected value in a combo box using VB? This is how I clear the combo box so it doesn't retrigger the NotInList event again when the user clicks OK on the "New Account" form. I put this code in the OnClose event of the "New SAM" form.

Forms![New Account].cbSamPortalID.Undo
Forms![New Account].cbSamPortalID.Requery

Thanks,
Chris
 
Before the 2nd form closes, run that code that requeries the combo box on the first form, then set the value of the combo box equal to the new value that was entered into the table. Something like: Forms![New Account].cbSamPortalID = MyNewValue
 
dcx693 said:
Before the 2nd form closes, run that code that requeries the combo box on the first form, then set the value of the combo box equal to the new value that was entered into the table. Something like: Forms![New Account].cbSamPortalID = MyNewValue

That did the trick. Thanks!

Chris
 

Users who are viewing this thread

Back
Top Bottom