How to select fields using either query criteria or a macro

A

AngelaA

I have created a database which logs operational data for an industrial water
plant.

I want to output a table of the data, based on inputs from the user. I've
created a form where the user can enter a date range for the data they want
to view, and a series of check boxes which correspond with the fields in the
underlying table.

In order to restrict the output data to the date range and fields required
by the database user, I have created a query. My problem is that I can't seem
to find a way to link the check boxes on my form to the 'show' checkbox in
the query. I have tried to create a macro with a conditional expression, ie
if the form checkbox is 'true', then set the query 'show' checkbox to 'true',
but this did not work.

Any advice would be appreciated.

Angela
 
A

Allen Browne

You cannot link the check boxes on your form to the Show row in query
design.

If you are comfortable with writing VBA code, it is possible to build a SQL
statement based on the fields you checked. You could then assign the string
to the SQL property of the QueryDef.

We can't tell from here, but it may be that using a relational design would
solve the problem. If you have scores of fields, it may be that you need to
use 3 tables. For example, if you were storing client health info, and you
had fields for the diseases the person has had (e.g. fields for ClientName,
Malaria, Chicken pox, Measles, ...) breaking the table into 3 tables would
be the best solution. If you want to research that further, search for
Normalization. Here's a starting point:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html#DatabaseDesign101
 

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