Requery a combo box

  • Thread starter Thread starter Sammie
  • Start date Start date
S

Sammie

While using formB to add items to a list, I need to requery a combo box
on a subform on formA, but I am having trouble referencing it from
formB. FormA is open. I want to requery the combo box without closing
formA.

I have tried
Forms![FormA]![SubformOnFormA]![MyCombo].Requery
and
Forms![SubformOnFormA]![MyCombo].Requery

The error message tells me that it can't find the first form after
forms! in either case.

What's wrong with my code?
Thanks.
Sammie
 
Try this code in the "On Got focus" event in your combo box:

me.mycombobox.requery
 
[SubformOnFormA] is the subform control; the actual form (subform) is a
property of that control. And since it's not open in its own right, just as
a subform, it's not a member of the Forms collection.
Try this syntax:
Forms![FormA]![SubformOnFormA].Form![MyCombo].Requery

HTH

Sammie said:
While using formB to add items to a list, I need to requery a combo box
on a subform on formA, but I am having trouble referencing it from
formB. FormA is open. I want to requery the combo box without closing
formA.

I have tried
Forms![FormA]![SubformOnFormA]![MyCombo].Requery
and
Forms![SubformOnFormA]![MyCombo].Requery

The error message tells me that it can't find the first form after
forms! in either case.

What's wrong with my code?
Thanks.
Sammie
=----
 

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