P
Palatini
Hi guys,
i am a medical staff in Australia. Please allow me to ask some silly
questions here.
In order to filter the report in a time frame, I built a form has two
textboxes and a button.
The filter string is like: [Date] between #01/01/2007# AND
#31/01/2007#
It works. the report only includes the 1st month of 2007. the date is
recognised as British style/format.
BUT, when the filter becomes #01/01/2007# AND #12/01/2007#
the reports includes 11 months in 2007 rather the 1st 12 days in 2007.
Obviously, the date 12/01/2007 is recognised as American stryle/
format.
Also, i built a query, but the code [Date] between#01/01/2007# AND
#12/01/2007#, the query only gives me the 1st 12 days in 2007. it
means query works properly.
here is my code. (I am not a professional programmer, the code may be
not that good. )
Private Sub btn_rpt_bymonth_Click()
On Error GoTo Err_btn_rpt_bymonth_Click
If IsNull(StartDate) Or IsNull(EndDate) Then
MsgBox "Please enter the start date and end date!"
Me.StartDate.SetFocus
Else
If EndDate >= StartDate Then
Dim stDocName As String
Dim filtersting As String
Dim finalfilter As String
Dim wardf As String
stDocName = "Rpt_Template_VRE_byMonth"
DoCmd.OpenReport stDocName, acPreview
filterstring = "Date between #" & StartDate & "# AND #" &
EndDate & "#"
wardf = Wardfilter
If wardf = "" Then
finalfilter = filterstring
Else
finalfilter = "(" & filterstring & ") AND (" & wardf &
")"
End If
Reports!Rpt_template_VRE_byMonth.Filter = finalfilter
Reports!Rpt_template_VRE_byMonth.FilterOn = True
Else
MsgBox "ERROR: Start Date > END Date"
Me.StartDate.SetFocus
End If
End If
Exit_btn_rpt_bymonth_Click:
Exit Sub
Please help. Thanks
i am a medical staff in Australia. Please allow me to ask some silly
questions here.
In order to filter the report in a time frame, I built a form has two
textboxes and a button.
The filter string is like: [Date] between #01/01/2007# AND
#31/01/2007#
It works. the report only includes the 1st month of 2007. the date is
recognised as British style/format.
BUT, when the filter becomes #01/01/2007# AND #12/01/2007#
the reports includes 11 months in 2007 rather the 1st 12 days in 2007.
Obviously, the date 12/01/2007 is recognised as American stryle/
format.
Also, i built a query, but the code [Date] between#01/01/2007# AND
#12/01/2007#, the query only gives me the 1st 12 days in 2007. it
means query works properly.
here is my code. (I am not a professional programmer, the code may be
not that good. )
Private Sub btn_rpt_bymonth_Click()
On Error GoTo Err_btn_rpt_bymonth_Click
If IsNull(StartDate) Or IsNull(EndDate) Then
MsgBox "Please enter the start date and end date!"
Me.StartDate.SetFocus
Else
If EndDate >= StartDate Then
Dim stDocName As String
Dim filtersting As String
Dim finalfilter As String
Dim wardf As String
stDocName = "Rpt_Template_VRE_byMonth"
DoCmd.OpenReport stDocName, acPreview
filterstring = "Date between #" & StartDate & "# AND #" &
EndDate & "#"
wardf = Wardfilter
If wardf = "" Then
finalfilter = filterstring
Else
finalfilter = "(" & filterstring & ") AND (" & wardf &
")"
End If
Reports!Rpt_template_VRE_byMonth.Filter = finalfilter
Reports!Rpt_template_VRE_byMonth.FilterOn = True
Else
MsgBox "ERROR: Start Date > END Date"
Me.StartDate.SetFocus
End If
End If
Exit_btn_rpt_bymonth_Click:
Exit Sub
Please help. Thanks