Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requerying a subform control from a form

Status
Not open for further replies.

Sam92Legacy

Technical User
Sep 9, 2002
52
0
0
US
I have a subform with a combo box for topics that describe the main form's record. When a topic needs to be added to the list, the user clicks on a button to bring up an "edit list" form. In order to refresh the combo box in the topic subform I've assigned this event for the edit list form's close button:

DoCmd.Close
Forms(Main).SetFocus
Me!Form(TopicSub).Topic.Requery

Where Main is the primary form, TopicSub is the subform, and Topic is the combo box. The edit form closes, the main form regains focus, but I get an error message saying that the command refers to an object that is either closed or doesn't exist. I've tripple-checked my spelling so I assume my grammar is wrong. Any suggestions?

Thanks,

Sam
 
Try this - Form_Mainformname.subformname.controlname.Requery

check the subform name is set to what you get when you right click properties the subform while in design view on the main form.

Only dead fish (and shit) go with the flow!
 
When I used that I got the error "Method or data member not found." with .Topic highlighted in blue and the Private Sub line in yellow. The subform name is the same as both a form and as an object in the main form. Could that be a problem?
 
having the same name is no problem. It helps to avoid confusion.

What about this -

DoCmd.Requery Topic
 
Forms![Main]![Topicsub]![Topic].Requery also works for sure (access97), i tested this one!

Only dead fish (and shit) go with the flow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top