Forms Date Parameters

  • Thread starter Thread starter John Torres
  • Start date Start date
J

John Torres

I have a report base on a query with date parameters (beggining date and
ending date). How can I have those date show on the report?
Thanks,
John
 
Hi John,

I presume you are entering your start and end dates directly into the query
criteria.

If you create a small form with unbound text boxes and a command button to
run the report. (Or put them on an existing form)
Enter your dates in these boxes.
In the criteria in your query you can referece these form fields - something
like

Forms![YourForm]![Start Date]
Forms![YourForm]![End Date]

Then on the report create 2 text boxes with recordsources referring to these
form fields

=Forms![YourForm]![Start Date]
=Forms![YourForm]![End Date]

Just remember, the form must be left open to read the criteria.

If you want to preview the report, use your report command button to render
the form invisible.
You can use the OnClose property of the report to make the form visible again.


I'm sure some of the more experienced guys on the forum will come up with a
better idea, but this has worked well for me.

Andy
 
Sorry John, Just noticed a screw-up.

The criteria in the query against the date field you are filtering on would
need to read something like:
Forms![My Form]![Start Date]-1 And <Forms![My Form]![End Date]+1

The -1 & +1 are to ensure the actual start & end dates are included rather
than just the period between them.

Andy
Hi John,

I presume you are entering your start and end dates directly into the query
criteria.

If you create a small form with unbound text boxes and a command button to
run the report. (Or put them on an existing form)
Enter your dates in these boxes.
In the criteria in your query you can referece these form fields - something
like

Forms![YourForm]![Start Date]
Forms![YourForm]![End Date]

Then on the report create 2 text boxes with recordsources referring to these
form fields

=Forms![YourForm]![Start Date]
=Forms![YourForm]![End Date]

Just remember, the form must be left open to read the criteria.

If you want to preview the report, use your report command button to render
the form invisible.
You can use the OnClose property of the report to make the form visible again.

I'm sure some of the more experienced guys on the forum will come up with a
better idea, but this has worked well for me.

Andy
I have a report base on a query with date parameters (beggining date and
ending date). How can I have those date show on the report?
Thanks,
John
 
Thanks for the input and I will give it a try. Appreciate it a lot.

AndyB via AccessMonster.com said:
Sorry John, Just noticed a screw-up.

The criteria in the query against the date field you are filtering on
would
need to read something like:
Forms![My Form]![Start Date]-1 And <Forms![My Form]![End Date]+1

The -1 & +1 are to ensure the actual start & end dates are included rather
than just the period between them.

Andy
Hi John,

I presume you are entering your start and end dates directly into the
query
criteria.

If you create a small form with unbound text boxes and a command button to
run the report. (Or put them on an existing form)
Enter your dates in these boxes.
In the criteria in your query you can referece these form fields -
something
like

Forms![YourForm]![Start Date]
Forms![YourForm]![End Date]

Then on the report create 2 text boxes with recordsources referring to
these
form fields

=Forms![YourForm]![Start Date]
=Forms![YourForm]![End Date]

Just remember, the form must be left open to read the criteria.

If you want to preview the report, use your report command button to
render
the form invisible.
You can use the OnClose property of the report to make the form visible
again.

I'm sure some of the more experienced guys on the forum will come up with
a
better idea, but this has worked well for me.

Andy
I have a report base on a query with date parameters (beggining date and
ending date). How can I have those date show on the report?
Thanks,
John
 

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

Back
Top