Re: Report Date Range or all dates

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: fredg (fgutkind_at_example.invalid)
Date: 12/29/04


Date: Wed, 29 Dec 2004 00:30:04 GMT

On Tue, 28 Dec 2004 13:11:03 -0800, James wrote:

> I have reports that only display between the dates on the "Reports Date
> Range" form. How do I have a button for "Month to date" and one for "All
> Records"?

One button is all you really need.
Code the Button's Click event:
If IsNull([StartDate]) and IsNull([EndDate]) then
        DoCmd.OpenReport "ReportName",acViewPreview
Else
        DoCmd.OpenReport "ReportName",acViewPreview, , "[DateField] Between
#" & Me![StartDate] & "# and #" & Me![EndDate] & "#"
End If

Enter no date at all to get all the records, or both to get the date
range wanted.

You will probably want to also check to see if just one of the dates
has been entered and give the user a chance to rectify it.

-- 
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Quantcast