combo box question - auto selecting newest entry

  • Thread starter Thread starter amieth
  • Start date Start date
A

amieth

Guest
I've searched through the combo box info on the site and have almost perfected what I need but for one last step.

So far I have a form which lists all of a clients purchases based on item_number. When an item is not in the combo box list, another form called AddItem opens. The user can add a new item_number and item_desc. When the AddItem form is closed the main form's combo box requeries and the new item is in the combo box list.

Only one thing is missing. What I would ideally like is for the new item_number to be already selected from the combo box once the AddItem form is closed. (Saves having to retype the new item_number).

Any suggestions of what code I should have in the CLOSE event of the AddItem form?

Thanks
 
try this...

This code can go either closing ur second form or if u have save or close button on ur second form.

DoCmd.close ' second form
Forms![frmMain].Visible = True ' assuming you are hiding the main form when you are opening the second form
Forms![frmMain].Requery ' refreshes the form, not reset like ur combo box.

GOOD LUCK
Dianna Goldsberg
 
Try ...

In the close event of the second form (AddItem) set the value of the combobox on the first form:

Forms!frmFirst.ItemNumber = Me.ItemNumber
 
andyweb said:
In the close event of the second form (AddItem) set the value of the combobox on the first form:

Forms!frmFirst.ItemNumber = Me.ItemNumber

That works great! Thanks
 

Users who are viewing this thread

Back
Top Bottom