I am the search code that Gromit kindly provided, however I want to include it to search between dates as well as the current search functionality that it has. So I have added the code below for Post Date – everything worked until I changed this from a LIKE to a BETWEEN….anyone know what I have done wrong?
Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim varColor As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
' Check for LIKE Centre
If Me.txtCentre > "" Then
varWhere = varWhere & "[Centre] LIKE ""*" & Me.txtCentre & "*"" AND "
End If
' Check for LIKE Account
If Me.txtAccount > "" Then
varWhere = varWhere & "[Account] LIKE ""*" & Me.txtAccount & "*"" AND "
End If
' Check for LIKE Post Date
If Me.txtPD1 > "" Then
varWhere = varWhere & "[Posted Date] BETWEEN ""*" & Me.txtPD1 & "*"" AND ""*" & Me.txtPD2 & "*"" AND "
End If
………………….
Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim varColor As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
' Check for LIKE Centre
If Me.txtCentre > "" Then
varWhere = varWhere & "[Centre] LIKE ""*" & Me.txtCentre & "*"" AND "
End If
' Check for LIKE Account
If Me.txtAccount > "" Then
varWhere = varWhere & "[Account] LIKE ""*" & Me.txtAccount & "*"" AND "
End If
' Check for LIKE Post Date
If Me.txtPD1 > "" Then
varWhere = varWhere & "[Posted Date] BETWEEN ""*" & Me.txtPD1 & "*"" AND ""*" & Me.txtPD2 & "*"" AND "
End If
………………….