Requery Subform ComboBox from Other Form

  • Thread starter Thread starter Ripper
  • Start date Start date
R

Ripper

I have a subform where the user will select a name of a person they are
reviewing, if the person is not there, they press a button that opens another
form where they can enter the person's name. However once they close that
form and return to the subform, the person's name doesn't show up in the
combobox.

How can I requery the combobox to look for the newly added name?

Main Form: frmDataAdd
Subform: subDataEdit
ComboBox: cboTeacherID
Teacher Add Form: frmTeacherAdd
 
Ripper said:
I have a subform where the user will select a name of a person they are
reviewing, if the person is not there, they press a button that opens another
form where they can enter the person's name. However once they close that
form and return to the subform, the person's name doesn't show up in the
combobox.

How can I requery the combobox to look for the newly added name?

Main Form: frmDataAdd
Subform: subDataEdit
ComboBox: cboTeacherID
Teacher Add Form: frmTeacherAdd


In your button's code, open the add form in Dialog mode,
then fokkow that with a line that requeies the combo box:

DoCmd.OpenForm "frmTeacherAdd", _
DataMode:= acFormAdd, _
WindowMode:= acDialog
Me.cboTeacherID.Requery
 
Ripper said:
Works Perfect! Thanks Marshall. What is Dialog Mode? I've never used that
before.


Dialog mode halts the code until the form is either closed
or made invisible. Without that, the requery would execute
before the user finished adding the new name.
 
Back
Top