Inserting Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've made my first report in Access...woohoo! My report is based-on a query, and when you run the report, it asks for a date range (Starting Date, Ending Date). Now, is there a way that I can insert these date criteria fields into the report (so that it shows 1-1-03 to 12-31-03)? I've been trying to insert bound and unbound objects with no success. Any help would be appreciated

Thanks!
 
Hi Rawley

congrats :)

however, AFAIK to achieve what you want to achieve you will need to use a
form to specify the start & end date criteria

to do this create a form (call it ReportDateRange for example) with two
unbound text boxes (and name the text boxes something like RPTSDATE and
RPTEDATE) then, go back to the query and change the criteria to
Forms![ReportDateRange].RPTSDATE and Forms![ReportDateRange].RPTEDATE
respectively (use the expression builder to get the exact syntax).

now put a button on this form - use the command button wizard, choose Report
Operations - Preview a Report (or whatever the exact wording is) - select
the appropriate report

then in design view of the report add a text box in in the control source of
the text box add the following
="Report Dates From: " & [forms]![ReportDateRange]![RPTSDATE] & " To " &
[forms]![ReportDateRange]![RPTEDATE]

and this should give you what you want.

Let us know how you go.

Cheers
JulieD

Rawley said:
I've made my first report in Access...woohoo! My report is based-on a
query, and when you run the report, it asks for a date range (Starting Date,
Ending Date). Now, is there a way that I can insert these date criteria
fields into the report (so that it shows 1-1-03 to 12-31-03)? I've been
trying to insert bound and unbound objects with no success. Any help would
be appreciated!
 
You can refer to the query parameters as if they are fields, so just put a
text box on your report and set its Control Source to:
=[Starting Date]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rawley said:
I've made my first report in Access...woohoo! My report is based-on a
query, and when you run the report, it asks for a date range (Starting Date,
Ending Date). Now, is there a way that I can insert these date criteria
fields into the report (so that it shows 1-1-03 to 12-31-03)? I've been
trying to insert bound and unbound objects with no success. Any help would
be appreciated!
 
If running the query produces the criteria prompt, opening
a report based on that query will do the same. I know
this because I spent quite a while trying to use a form to
enter the criteria, but kept getting the Enter Parameter
Value (or whatever exactly) dialog box when I opened the
report. The form is a much better way, IMHO, of entering
parameters. I think the command button needs to have
DoCmd.Minimize or something to make the form go away or
hide, but maybe I left something out of my attempts. I
used a slightly different approach (opened the form from
the report's On Open event, and used the command button on
the form to minimize the form after entering the
criteria), based on a newsgroup posting, so I never worked
out the details of your approach. I'm still trying to
figure out how to get back to the form when I need to
enter new parameters.
Julie, I want to tell you I have made great progress on my
database projects, thanks in no small part to your
generous assistance. Always glad to see your name in this
forum.
-----Original Message-----
Hi Rawley

congrats :)

however, AFAIK to achieve what you want to achieve you will need to use a
form to specify the start & end date criteria

to do this create a form (call it ReportDateRange for example) with two
unbound text boxes (and name the text boxes something like RPTSDATE and
RPTEDATE) then, go back to the query and change the criteria to
Forms![ReportDateRange].RPTSDATE and Forms! [ReportDateRange].RPTEDATE
respectively (use the expression builder to get the exact syntax).

now put a button on this form - use the command button wizard, choose Report
Operations - Preview a Report (or whatever the exact wording is) - select
the appropriate report

then in design view of the report add a text box in in the control source of
the text box add the following
="Report Dates From: " & [forms]![ReportDateRange]! [RPTSDATE] & " To " &
[forms]![ReportDateRange]![RPTEDATE]

and this should give you what you want.

Let us know how you go.

Cheers
JulieD

I've made my first report in Access...woohoo! My
report is based-on a
query, and when you run the report, it asks for a date range (Starting Date,
Ending Date). Now, is there a way that I can insert these date criteria
fields into the report (so that it shows 1-1-03 to 12-31- 03)? I've been
trying to insert bound and unbound objects with no success. Any help would
be appreciated!


.
 
Back
Top