Uldis007
New member
- Local time
- Today, 06:10
- Joined
- Nov 17, 2021
- Messages
- 22
Hello!
I'm trying to create a filter that filters between the start and end dates, but there is a syntax error that I can't find.
The other filters work fine, but as I try to filter between dates it shows error 3075
Help please!
Here is my code
I'm trying to create a filter that filters between the start and end dates, but there is a syntax error that I can't find.
The other filters work fine, but as I try to filter between dates it shows error 3075
Help please!
Here is my code
Code:
Private Sub btnSearchCase_Click()
Dim strFilter As String
strFilter = "1=1"
If CaseSearchBox <> "" Then
strFilter = strFilter & " AND [RemontaPieteikumaNumurs]=" & CaseSearchBox
End If
If CarRegNumberSearchBox <> "" Then
strFilter = strFilter & " AND [ReģistrācijasNumurs]='" & CarRegNumberSearchBox & "'"
End If
If CarNumberSearchBox <> "" Then
strFilter = strFilter & " AND [GarāžasNumurs]=" & CarNumberSearchBox
End If
If StatusSearchBox1 <> "" Then
strFilter = strFilter & " AND [LastOfStatuss]='" & StatusSearchBox1 & "'"
End If
'This is the part where I get stuck
If IsDate(Me.StartDateSearchBox) And IsDate(Me.StartDateSearchBox) Then
strFilter = strFilter & " [PieteikumaDatums] BETWEEN #" & Me.StartDateSearchBox & "# AND #" & Me.StartDateSearchBox & "#"
End If
Me.Filter = strFilter
Me.FilterOn = True
End Sub