print date range in report

lakshmi_pili

Registered User.
Local time
Today, 05:51
Joined
May 9, 2001
Messages
10
I have this report which runs based on a query. Under the criteria for the DATE field, I have put a >=[SDate] and <=[EDate]. My report works okay, but what I would like to do is print that date range. I cannot figure it out.

Can anyone suggest anything?

Thank you!
 
Look under help topic:
reports, criteria to select data to include
 
Thank you, but the problem I have is that it works under Access 97, but not on Access 2000.

Any other suggestions?
 
I use Access 2000, and this works for me:

Create a text box in the report header, and set the control source to the parameter in your query - [SDate]

Create another one for [EDate]

The help files say you can have both parameters in on text box like:

"Between " & [SDate] & " and " & [EDate]

but I got nothing but errors when I tried it.
 
Here is a variation of karatelung's suggestion with some added features. I use this on a command button to open a report based on the beginning and ending date entered into two text boxes.

Private Sub cmdSelect_Click()

Dim bProcOk As Boolean
bProcOk = True

' The following IF Then series checks for null values in
' the start txtbox. If a null is found the error message
' is displayed and the focus is sent back to form control

If IsNull(Me.txtBeginDate) Then

MsgBox "You must provide a beginning date!", vbExclamation, "Error"
txtBeginDate.SetFocus
bProcOk = False

Else

If IsNull(Me.txtEndDate) Then
MsgBox "You must provide a ending date!", vbExclamation, "Error"
txtEndDate.SetFocus
bProcOk = False

End If
End If

If bProcOk Then ' If the above IF Thens are satisfied
' the following command is carried out

DoCmd.OpenReport "EmpContactLog", acPreview, , _
"[date]>=#" & Me![txtBeginDate] & "# And [date]<= #" & _
Me![txtEndDate] & "#"

' Opens the report based on the begin and end date

End If

End Sub
 
Talismanic,

Your way is definitely more user-friendly. You can review both the starting and ending dates before you preview the report. I'll try it out.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom