Report Criteria: Query works, but report doesn't call up query???

G

Guest

I'm trying to create a report where the the user can enter criteria
(beginning date, end date) to generate a report.

*I've created a form to enter the criteria. (with macros "ok", "cancel").
*I've created the query to generate the report.

The query itself works. The form opens and allows me to enter the criteria.

However, they don't seem to work together. When I open the form, enter the
criteria, and click "ok" (macro), it doesn't seem to know to run the query.
Instead, it pulls all of the records from the record source. How can I get
the criteria form to work with the actual query - and get it to show in the
report????
All advise is greatly appreciated.
 
G

Guest

Just a thought... is there something I can do with my "OK" macro that is
clicked after the criteria is entered? Something that would get my criteria
into the query?
 
M

Marc

*I've created a form to enter the criteria. (with macros "ok", "cancel").
*I've created the query to generate the report.

The query itself works. The form opens and allows me to enter the
criteria.

However, they don't seem to work together. When I open the form, enter
the
criteria, and click "ok" (macro), it doesn't seem to know to run the
query.
Instead, it pulls all of the records from the record source. How can I
get
the criteria form to work with the actual query - and get it to show in
the
report????
All advise is greatly appreciated.

Hi

a) in the report open event (VBA code) - update the filter on the query /
table the report is based on by setting the .filter and making .filteron =
true

OR
b) in the report design view - make the recordsource the query

Either case - you do know how many records you expect to be printed out?
hth
Marc
 
J

John Vinson

I'm trying to create a report where the the user can enter criteria
(beginning date, end date) to generate a report.

*I've created a form to enter the criteria. (with macros "ok", "cancel").
*I've created the query to generate the report.

The query itself works. The form opens and allows me to enter the criteria.

However, they don't seem to work together. When I open the form, enter the
criteria, and click "ok" (macro), it doesn't seem to know to run the query.
Instead, it pulls all of the records from the record source. How can I get
the criteria form to work with the actual query - and get it to show in the
report????
All advise is greatly appreciated.

You don't need to "run" the Query at all. Instead, change the Report's
Recordsource property to the name of the query. The macro behind your
button should simply open the Report - which will in turn call the
query.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

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