Hi All,
My date range code having "Run-time error 13: Type mismatch"
Not sure what I have done wrong!
When I debug, it pointed and highlighted at below sentence in yellow (which is below font in red)
Sub Search()
Dim strFilter As String
If Not IsNull(Me.OpenFrom) Then
strFilter = " AND OpenedDate >= #" & Format(Me.OpenFrom, "mm/dd/yyyy") & "#"
End If
If Not IsNull(Me.OpenTo) Then
strFilter = strFilter & " AND OpenedDate <= #" & Format(DateAdd("d", 1, Me.OpenTo), "mm/dd/yyyy") & "#"
End If
strFilter = strFilter & " AND (Country='zzz'"
If Nz(Me.chkSIN, False) Then
strFilter = strFilter & " OR Country='Singapore'"
End If
If Nz(Me.chkMAL, False) Then
strFilter = strFilter & " OR Country='Malaysia'"
End If
If Nz(Me.chkIDN, False) Then
strFilter = strFilter & " OR Country='Indonesia'"
End If
If Nz(Me.chkPHI, False) Then
strFilter = strFilter & " OR Country='Philippines'"
End If
strFilter = strFilter & ")"
strFilter = strFilter & " AND (Status='zzz'"
If Nz(Me.chkOpen, False) Then
strFilter = strFilter & " OR Status='Open'"
End If
If Nz(Me.chkPending, False) Then
strFilter = strFilter & " OR Status='Pending'"
End If
If Nz(Me.chkResolved, False) Then
strFilter = strFilter & " OR Status='Resolved'"
End If
strFilter = strFilter & ")"
If strFilter = "" Then
Me.Filter = ""
Me.FilterOn = False
Me.Total = FindRecordCount("SELECT * FROM Issues")
Else
' Remove first " AND "
Me.Filter = Mid(strFilter, 6)
Me.FilterOn = True
Me.Total = FindRecordCount("SELECT * FROM Issues WHERE " & Me.Filter)
End If
End Sub