Jibbadiah
James
- Local time
- Today, 12:31
- Joined
- May 19, 2005
- Messages
- 282
Hey folks, I have worked on this for a bit... and have finally given up. The filter works for the other variables, but the dates don't work. My regional settings are set to UK, but I think it may be converting them to US format in Access. The filter on dates either applies and brings back random results, or it brings back nothing. I have tried many variations. Maybe what I want is to do a comparison based on the date integer - can someone give me their best shot please... may be a good tester for Pat or SJ!!
Private Sub Populate_Historic_Report_Click()
Dim Start_Date As Date
Dim End_Date As Date
Dim StrSortcode As String
Dim StrDate_Selection As String
Dim StrProspects As String
Dim FullString As String
If IsNull(Me!Start_Param) Then
Start_Date = CDate(Format("26/05/2005", "dd/mm/yyyy"))
Else: Start_Date = CDate(Format(Me!Start_Param, "dd/mm/yyyy"))
End If
If IsNull(Me!End_Param) Then
End_Date = CDate(Format(Now(), "dd/mm/yyyy"))
Else: End_Date = CDate(Format(Me!End_Param, "dd/mm/yyyy"))
End If
StrDate_Selection = "(((Run_Date) Between (#" & Start_Date & "#) And (#" & End_Date & "#)) AND "
If IsNull(Me!Sortcode_Param) Then
StrSortcode = "((Best_Branch) Is Not Null) AND "
Else: StrSortcode = "((Best_Branch) = '" & Me!Sortcode_Param & "') AND "
End If
If IsNull(Me!Prospect_Param) Then
StrProspects = "((Keycode) Is Not Null))"
Else: StrProspects = "((Keycode) = '" & Me!Prospect_Param & "'))"
End If
FullString = "" & StrDate_Selection & StrSortcode & StrProspects & ""
DoCmd.OpenReport "Prospects_Historic_Report", acViewPreview, , FullString
End Sub
Private Sub Populate_Historic_Report_Click()
Dim Start_Date As Date
Dim End_Date As Date
Dim StrSortcode As String
Dim StrDate_Selection As String
Dim StrProspects As String
Dim FullString As String
If IsNull(Me!Start_Param) Then
Start_Date = CDate(Format("26/05/2005", "dd/mm/yyyy"))
Else: Start_Date = CDate(Format(Me!Start_Param, "dd/mm/yyyy"))
End If
If IsNull(Me!End_Param) Then
End_Date = CDate(Format(Now(), "dd/mm/yyyy"))
Else: End_Date = CDate(Format(Me!End_Param, "dd/mm/yyyy"))
End If
StrDate_Selection = "(((Run_Date) Between (#" & Start_Date & "#) And (#" & End_Date & "#)) AND "
If IsNull(Me!Sortcode_Param) Then
StrSortcode = "((Best_Branch) Is Not Null) AND "
Else: StrSortcode = "((Best_Branch) = '" & Me!Sortcode_Param & "') AND "
End If
If IsNull(Me!Prospect_Param) Then
StrProspects = "((Keycode) Is Not Null))"
Else: StrProspects = "((Keycode) = '" & Me!Prospect_Param & "'))"
End If
FullString = "" & StrDate_Selection & StrSortcode & StrProspects & ""
DoCmd.OpenReport "Prospects_Historic_Report", acViewPreview, , FullString
End Sub