Update Combo Box not Working

  • Thread starter Thread starter Melinda Chase
  • Start date Start date
M

Melinda Chase

Hello,
I have a number of subforms which contain combo boxes. I have buttons that
open forms to allow me to enter more values in the tables the combo boxes
are pulling from. On the forms' close events, I requery the combo boxes.
This is working beautifully for one instance, but not the other.
Here is the code that doesn't work:

Private Sub Form_Close()
Form_frmEmployeeOrganizationSub.OrgID.Requery
End Sub

But this code does work:

Private Sub Form_Close()
Form_frmEmployeeCertificationSub.CertificationID.Requery
End Sub

The error I get says it can't find the target. I've tried moving the
requery to on click event of the button that opens the form, but I get a
similar error. It just doesn't believe that the OrgID field on the
frmEmployeeOrganizationSub exists.

And, yes, I've tripled check that everything has the correct name.

Any ideas?
Thanks!
Melinda
 
Referring to subforms is different than referring to forms. The form that is
being used as a subform doesn't actually get added to the Forms collection,
so you have to address it through the parent form.

In general, you'd use

Forms!NameOfParentForm!NameOfSubformControlOnParentForm.Form!NameOfControlOnSubform.Requery

Note that depending on how you added the form as a subform on the parent
form, the name of the subform control may be different than the name of the
form being used as a subform. It's important that you use the name of the
subform control.
 

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

Back
Top