lakshmi_pili
05-09-2001, 06:29 AM
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!
pdx_man
05-09-2001, 08:59 AM
Look under help topic:
reports, criteria to select data to include
lakshmi_pili
05-09-2001, 11:24 AM
Thank you, but the problem I have is that it works under Access 97, but not on Access 2000.
Any other suggestions?
karatelung
05-10-2001, 08:47 AM
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.
Talismanic
05-10-2001, 10:56 AM
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
karatelung
05-10-2001, 12:34 PM
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.