Combo Box Updating queries (1 Viewer)

rghaddad@inco.com.lb

Registered User.
Local time
Today, 21:03
Joined
Dec 5, 2013
Messages
16
Good morning All,

I have create a form from scratch in which I included a combo box linked to a table (customers table)

next, I created a query that outputs all the order made by a specific Client based on the selection of the above combo box.

so far all works perfectly well.

Next I dragged the query into that form. It won't update.

I created a Macro that runs when the combobox changes. The query runs perfectly well but typically opens as a separate window. Yet it won't update within the form.

is there a VBA command to "update" or "Run" a query within a form without displaying it.

Thanks in advance

Roland
 

Attachments

  • SubForm_01.png
    SubForm_01.png
    49.8 KB · Views: 43
  • SubForm_02.png
    SubForm_02.png
    12.2 KB · Views: 43

CJ_London

Super Moderator
Staff member
Local time
Today, 19:03
Joined
Feb 19, 2013
Messages
16,713
your code is opening the query, the query on your form is a separate iteration so won't be updated until you close and reopen the form

Normally you would use the linkchild/linkmaster properties of the subform control. But without knowing more, difficult to say

Assuming your query simply filters based on the customer selected in the combo, then linkmaster will have the name of the combo control (which should be unbound by the way) and the linkchild the name of the equivalent field in your query. You can then remove the relevant criteria from the query.

Otherwise use a different code

SubforControlName.Requery

Substitute the name of your subform
 

rghaddad@inco.com.lb

Registered User.
Local time
Today, 21:03
Joined
Dec 5, 2013
Messages
16
SubforControlName.Requery is exactly what I needed
thanks a lot
 

Users who are viewing this thread

Top Bottom