help filtering a form's query indirectly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi - my form is based on qryCustomer2. In the header are 2 comboboxes that
are not bound to the query. The selections from these, comboP and comboQ,
are needed to filter results using code. BUT... (here's where I get
confused) they need to filter results in another query, qryCustomer1, that
qryCustomer2 is based on. After qryCustomer2 is Requeried, the form should
show the correct results. Could some kind coder out there sketch out how to
go about this?

grateful for the hand
 
The way that I do it is to create a query and use it as a record source.
Within the where clause of the query put (example is for characters):

like "*" & [forms]![formname]![filter textbox name] & "*"

and within the after update event of the forms [filter textbox name] put:

DoCmd.Requery

Since you refer to a Combo box, is the second query based on the bound
column or the text that is displayed?

For bound columns try within the where clause of the query:
[forms]![formname]![filter Combox name]

For displayed columns try within the where clause of the query (This refers
to the second column in the Combox):
[forms]![formname]![filter Combox name].column(1)

or

like "*" & [forms]![formname]![filter Combox name].Column(1) & "*"


Remember to requery after update!


It works pretty nicely...
 
Back
Top