Form Combo Box Not Updating

  • Thread starter Thread starter rodgeraj
  • Start date Start date
R

rodgeraj

I've got a number of combo boxes on a new form that reference
information like Associates. The combo box lists each associate
currently stored it the associates table and stores the associate id
from that table into the Projects table. If a new associate needs to
be added, I've got a command button that opens the Associate Detail
form and I add the associate there. That new associate does not,
however, show up in the combo box until I close and reopen the form.
What am I missing?

Thanks,
rodgeraj
 
I've got a number of combo boxes on a new form that reference
information like Associates. The combo box lists each associate
currently stored it the associates table and stores the associate id
from that table into the Projects table. If a new associate needs to
be added, I've got a command button that opens the Associate Detail
form and I add the associate there. That new associate does not,
however, show up in the combo box until I close and reopen the form.
What am I missing?

The combo box needs to be requeried after the new associate is added.
If your command button opens the Associate Detail form in dialog mode
(so that all processing is held up until that form is closed), you can
do it in the button's Click event procedure immediately after the line
of code that opens the form. Like this:

'----- start of example code -----
Private Sub cmdAddAssociate_Click()

DoCmd.OpenForm "frmAssociateDetail", _
DataMode:=acFormAdd, WindowMode:=acDialog

Me.cboAssociate.Requery

End Sub
'----- end of example code -----
 
Back
Top