Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2007

Tip: Looking for answers? Try searching our database.

query Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rocky - 06 Dec 2007 16:36 GMT
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
Klatuu - 06 Dec 2007 20:33 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> 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.
[quoted text clipped - 27 lines]
>
> Rocky Bolin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.