criteria change

M

McDiad

is there a way to change the criteria of a query baseed on
user input from a combo box. i'm thinking of vba code that
sets the criteria of a query based on a user selection.

thanks
 
A

Al Camp

McDaid,
I'm not sure if I understand, but if my suggestion is off the mark...
please give an example of what you want to do.

An example of a criteria that gets it's value from a combo box on a
form...

First the form... called frmForm1 with a combo box called
cboCustomerID...
Second the report... with a query behind it and field called
CustomerID...

In the report query, in the CustomerID field, put a criteria of...
=Forms!frmForm1!cboCustomerID

Now when the user selects a CustomerID via cboCustomerID, and runs the
report, the query for the report uses the cboCustomerID on frmForm1 for it's
criteria/filtering value.
 
S

Scott

al,

thanks for the quick reply. it's right on target. i didn't
phrase the question correctly however.

what i want to do is use a series of combo boxes to allow
the user to refine the criteria for the query which will
generate the report.

the structure is this; region, district, center,
superivisor.

the selection of region would restrict what districts
would be shown in the district combo box. the selection of
district would restrict what centers would be available in
the center combo box, ect.

the idea is that the user would be able to select 1, some,
or all of the criteria and generate a report.

i see the criteria for succeeding fields in the query
changing based on the selections of the user. But if there
is no selection for a field, ie the user chose to run the
report without selecting criteria for all fields, the
report would still run based on what was selected.

again, thanks
 

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

Top