Subform Requery

AlanSearle

New member
Local time
Today, 17:42
Joined
Sep 7, 2011
Messages
5
Hi Everyone,

In my main forms I use me.myobject.requery to refresh particular list and combo boxes. That works fine.

I tried using this in subforms because I found that, when the main form was refiltered, the subform refiltered correctly but any combo-boxes in that form did not refresh.

I'm sure I used the correct syntax ...

Forms!formname!subformname.Form.controlname.requery

... but the combo simply wouldn't refresh.

I tried various permutations of refreshing and requerying the subform but that didn't work and in the end used the SendKeys "{F9}" sledge-hammer. That fixed it but caused error messages / warnings under certain (unpredictable) circumstances.

Can anyone give me a tip here? How can I do this cleanly so that the user can navigate through data with the form, the subform and the combos contained in the subform correctly refreshing?

I have a potential solution which would involve double-clicking on potentially editable fields and a pop-up being displayed when then writes the data back. This would work fine but it seems to be extra programming where a simple requery would do.

Many thanks for any help that you can give me.

Regards,
Alan Searle
Cologne, Germany
 
I have on occasion put Me.ControlName.Requery in the OnEnter or GotFocus event of a ComboBox to resolve the issue.
 
That's a good tip, thanks.

But what I really need is something which doesn't require the user to go to the control but forces a requery when triggered by an event (e.g. a re-selection / re-filtering) on the main form.

Regards and many thanks for the feedback / suggestion.
 
If the code is running on the MainForm you can use the alterbative syntax:
SubFormControlName.FORM.ControlName.Requery
...which eliminates the first part of the syntax.
 
maybe the combo box IS refreshing/requerying

perhaps the source query for the combobox is not correct.
 
Is the combo box bound?
Are you filtering the combo box in code?
Is the form a Single Form, Continuous Form or in Datasheet View?
 

Users who are viewing this thread

Back
Top Bottom