CRITERIA

C

Christina

I have a report and a sub report running from two queries for which the
criteria in both is Betweenn one date and another date. When running the
report, I have to input the criteria beginning and ending date twice. Please
for help so that I only input the criteria once.

Thanks
 
K

Ken Snell \(MVP\)

Use a form to run the report (via a command button). On the form, put two
textboxes, one for each of the date values. Format the textboxes for Short
Date or any other date format you wish. Change the two queries so that they
read the parameters from the form (keep it open while the report runs):

[Forms]![NameOfTheForm]![NameOfTheTextbox]
 
J

Jack Cannon

Another approach is use a form containing two calendars (BegCalendar and
EndCalendar).

Each calendar loads their respective global variables (BegDate and EndDate)
during the Form_Unload or Form_Close events. I would also suggest that each
global variable be loaded prior to opening the dual calendar form. Those
variables can then be used to establish a default value for each calendar
(such as today's date).

The queries controlling the report cannot directly access these global
variables but the queries can execute a function that returns the global
variables (GetBegDate() and GetEndDate()).

The dual calendar form can be opened as part of the procedure that opens the
report.

Using this approach eliminates the need to hold any form (including the dual
calendar form) open while the report prints. Also the same dual calendar
form can be used throughout the application for similar objectives since the
dual calendar form is not tied to particular procedure within the application.

Jack Cannon


Ken Snell (MVP) said:
Use a form to run the report (via a command button). On the form, put two
textboxes, one for each of the date values. Format the textboxes for Short
Date or any other date format you wish. Change the two queries so that they
read the parameters from the form (keep it open while the report runs):

[Forms]![NameOfTheForm]![NameOfTheTextbox]
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Christina said:
I have a report and a sub report running from two queries for which the
criteria in both is Betweenn one date and another date. When running
the
report, I have to input the criteria beginning and ending date twice.
Please
for help so that I only input the criteria once.

Thanks
 

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

Similar Threads

criteria 17
criteria 1
Access Dcount (multiple criteria) 3
criteria 27
dialog box 1
criteria on form 1
Report and Subreport with Date Range Criteria 4
Parameters in a Report 2

Top