Report parameters with Start/End Dates using Date()

B

BillH

A recent thread demonstrated how to query a group of Reports with the
user having to simply enter the Start and End date. My question is
whether a relative date grouping for Starting and Ending can be
defined using, for example, the expression Between Date() and
Date()-'x'.

Thanks - WHoward
 
M

Marshall Barton

BillH said:
A recent thread demonstrated how to query a group of Reports with the
user having to simply enter the Start and End date. My question is
whether a relative date grouping for Starting and Ending can be
defined using, for example, the expression Between Date() and
Date()-'x'.


Sure. The where condition would be like:

datefield Between DateAdd("d", x, Date()) And Date()
 
M

Marshall Barton

BillH said:
Where specifically would this expression be written?


Depends on what you are doing to open the reports, what kind
of queries the reports are based on and how you obtain the
value of x.

What I posted would be used in a query's WHERE clause.

In the query design grid, you would use:
Between DateAdd("d", x, Date()) And Date()
in the criteria row under the datefield.

If you are using a form button to open the report and the
report's are based on a table or the datefield only occirs
in the top level of a chain of queries, then you could use
the OpenReport method's WhereCondition argument:
"datefield Between DateAdd(""d"", x, Date()) And Date()"

If that's not sufficient to get you going, then pleas
provide more detailed information about what you are doing.
 

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