Report by month

B

Bill Neilsen

I have some reports I need to run on monthly activities. Until now I've had
the parameters in the Date field in my query "Between [First Date] and
[Second Date]".
Is there a better way of selecting date parameters?
Specifically, is there a way to simply specify a previous month and also
current month to date?
 
M

Marshall Barton

Bill said:
I have some reports I need to run on monthly activities. Until now I've had
the parameters in the Date field in my query "Between [First Date] and
[Second Date]".
Is there a better way of selecting date parameters?
Specifically, is there a way to simply specify a previous month and also
current month to date?


A common approach it to use a form button to launch the
report. You can then use one ot two text boxes to allow
users to specify the month or a date range. The trick with
this approach is to use the OpenReport method's
WhereCondition argument to apply the filter so neither the
report nor its record source table/query is aware of the
filtering criteria.

If all you want is to specify a month number in a text box
on the form, the code in the button"s Click event procedure
woul;d look something like:

Dim stCriteria As string
If Is Null(Me.textbox) Then
MsgBox "Please specify the month number"
Else
stCriteria = "Month(datefield) = " & Me.textbox
DoCmd.OpenReport "reportname", acPreview, , stCriteria
End If
 

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