J
Jon
hi,
I am using Allen Browne advance filter code:
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#dd\/mm\/yyyy\#"
If Not IsNull(Me.txtStartDate) Then
strWhere = strWhere & "([vacationdate] >= " & Format(Me.txtStartDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.txtEndDate) Then
strWhere = strWhere & "([vacationdate] < " & Format(Me.txtEndDate +
1, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND
" at the end.
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
but the msg "type mismatch error 13" shows & highlighted at the line:
If Not IsNull(Me.txtEndDate) Then
strWhere = strWhere & "([vacationdate] < " & Format(Me.txtEndDate +
1, conJetDate) & ") AND "
End If
Please help???
I am using Allen Browne advance filter code:
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#dd\/mm\/yyyy\#"
If Not IsNull(Me.txtStartDate) Then
strWhere = strWhere & "([vacationdate] >= " & Format(Me.txtStartDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.txtEndDate) Then
strWhere = strWhere & "([vacationdate] < " & Format(Me.txtEndDate +
1, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND
" at the end.
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
but the msg "type mismatch error 13" shows & highlighted at the line:
If Not IsNull(Me.txtEndDate) Then
strWhere = strWhere & "([vacationdate] < " & Format(Me.txtEndDate +
1, conJetDate) & ") AND "
End If
Please help???