Complex Query

W

Wayne

Hello,

I am trying to set up a checkbox page that would allow the user to select
from various options to be applied as a filter to the dbase.

Table - Contact
Form - Contact
ie. -
Yes/No - Adult Yes/No - Teen Yes/No - Child
Yes/No - Male Yes/No - Female

I would like to allow the user to select any combination of the above, then
that selection would be used to create a custom query.

Is this possible? or, am I over reaching the boundaries?

I have tried buildcriteria and applyfilter, but I must be doing something
wrong. I know that I could create a query and then use the applyfilter
command, but I have over 20 different options and that would be an
astronomical number of queries to make up.

any help?
Thanks,
Wayne
 
G

Guest

piece of cake.

Put them on your form and save it.

Go to the query, place your cursor in the appropriate criterea area.
Hit the experssion builder button and point it to the proper object on your
form
 
G

Guest

Wayne,

Since presumably one cannot be simultaneously Male and Female, nor an Adult,
Teen, and a Child, an option group would be a better choice here, and reduce
the number of controls.

Sprinks
 
J

JP

Two possibilities:

1. Make a form based on your table, with all the appropriate checkboxes or
frames or whatever. Then just give the user the Filter by Form and the
Filter commands in a toolbar for that form (the lookup form). When you hit
the filter by form toolbar button, it gives you a filter form -- an empty
view of the form (i.e., no data in the form) into which the user can enter
filter criteria (e.g., male, teen). When you press the filter button on the
toolbar, it then gives a filtered set of all records in the table that meet
the criteria established in the filter. Simple, and no coding required.

2. More complex, but can be used to populate reports, etc. Have a form
into which the user enters the criteria. On the form is a search button.
When clicked, it invokes some VBA code that looks at the various fields in
the search form and builds an SQL string to retrieve records that meet the
filter criteria.
 

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