query Form

R

Rocky

At work, we use a large database. In it, there are 400 records for
personnel. The table this is based on has about 40 fields.

Currently, whenever we need to print out a report with different queries, I
need to make the query from scratch. Although not hard, I don't want to keep
doing this as my boss thinks of new things. So what I would like to do is
create one form.

This form will have 10 drop down menus. The first drop down will be the
field the query will sort by. After that, each option they choose will be a
field the query will pull.

For example:

Command: Field5
Command: Field9
Command: Field13
etc.....

Once all these options are chosen, the form creates a query based off that
information. If possible, maybe an extra box below the selection to place
the query material itself. Such as a certain date. Or something.

Then, after the query is built, I would like a report to be created based
off the query.

Is there any way to do this?

Thank you!


Rocky Bolin
 
K

Klatuu

A report needs a stored query, so if you need to create the query
programmatically, you will have to save the query.

However, there is a much better way to do this.
Create a generic query that includes the fields your report needs and make
that the record source of the query.

Instead of creating a query with your criteria, just create the criteria as
a string variable that would be a valid SQL WHERE clause, without the word
Where. Then use this string variable as the Where argument of the OpenReport
method.
 

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