Requery Subform ComboBox from Other Form

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
 
M

Marshall Barton

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
 
M

Marshall Barton

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top