R
RebeccaMinAR
Your help is appreciated. I inhereted a mess of a program, and am hoping to
use the wonderful Allen Browne Search form to dig the data out.
I've got this coded, and it's not working! I keep getting an error related
to the last statements - on the me.filter line, near the end. I know it's
just a simple thing, but it's making me nuts!
Can someone take a look and see where I screwed up? Thanks!
-----------------------------
Private Sub Command21_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.RegSiteNameSearch) Then
strWhere = strWhere & "([RegSiteName] Like ""*" &
Me.RegSiteNameSearch & "*"") AND "
End If
If Not IsNull(Me.RegInitialSubDateFIRST) Then
strWhere = strWhere & "([RegInitialSubDate] >= " &
Format(Me.RegInitialSubDateFIRST, conJetDate) & ") AND "
End If
If Not IsNull(Me.RegInitialSubDateLAST) Then
strWhere = strWhere & "([RegInitialSubDate] <= " &
Format(Me.RegInitialSubDateLAST, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 2
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
Me.Filter = "(strWhere, lngLen)"
Me.FilterOn = True
End If
End Sub
use the wonderful Allen Browne Search form to dig the data out.
I've got this coded, and it's not working! I keep getting an error related
to the last statements - on the me.filter line, near the end. I know it's
just a simple thing, but it's making me nuts!
Can someone take a look and see where I screwed up? Thanks!
-----------------------------
Private Sub Command21_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.RegSiteNameSearch) Then
strWhere = strWhere & "([RegSiteName] Like ""*" &
Me.RegSiteNameSearch & "*"") AND "
End If
If Not IsNull(Me.RegInitialSubDateFIRST) Then
strWhere = strWhere & "([RegInitialSubDate] >= " &
Format(Me.RegInitialSubDateFIRST, conJetDate) & ") AND "
End If
If Not IsNull(Me.RegInitialSubDateLAST) Then
strWhere = strWhere & "([RegInitialSubDate] <= " &
Format(Me.RegInitialSubDateLAST, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 2
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
Me.Filter = "(strWhere, lngLen)"
Me.FilterOn = True
End If
End Sub