I'll answer your 2nd question first. By the context of your question I'm assuming you have a 2nd form that adds data to your table, and after adding a new record and closing the form, you want that to be reflected in the combo on your first form. Is that about right? If so, create an event procedure in the On Close event of the 2nd form, something like this:
Code:
Forms!frmForm1!cboMyCombo.Requery
...substituting your form and field names as appropriate.
With your first question, I'm not quite sure what you're asking. Do you mean that you want the combo's display to change from displaying one column to display two columns after making a selection in the combo? Or do you want the info displayed elsewhere on the form?
Maturi - great stuff jus what i wanted
Eupher - have a requery in the onclose event of the form that adds to the combo-but does not set the recent data combos selection
Okay, I'm not sure of the exact sequence of events when the On Close event fires, so I don't know if the new record is being saved before the requery occurs. And if the requery occurs before the record is saved, the requery obviously accomplishes nothing. A couple of things to try:
1) In the On Close event procedure, add this line before the requery line:
Code:
DoCmd.RunCommand acCmdSaveRecord
2) An alternative (maybe a better choice) is to open the form in dialog mode and put your combo requery in the code on the *original* form immediately after the code that opens the new record form, i.e:
By opening the form in dialog mode, you suspend execution of the code until the form closes, so the requery would take place after the new record gets written.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.