T
Tal
Hello all,
I have a search form that I have been coding and testing with each filed
addition.
Everything worked perfectly until the last field (cboCampaign) was added.
Now I get a error 3075 extra ) in string. Any assistance is greatly
appreciated.
Cheers,
Tal
Here's the code:
Private Sub btnApplyFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterDonorName) Then
strWhere = strWhere & "([compFileAs] Like ""*" & Me.txtFilterDonorName &
"*"") AND"
End If
If Not IsNull(Me.txtFilterDonorAddress) Then
strWhere = strWhere & "([compAddress] Like ""*" &
Me.txtFilterDonorAddress & "*"") AND"
End If
If Not IsNull(Me.txtFilterDescription) Then
strWhere = strWhere & "([txtDescription] Like ""*" &
Me.txtFilterDescription & "*"") AND"
End If
If Not IsNull(Me.txtFilterReceiptTo) Then
strWhere = strWhere & "([txtReceiptTo] Like ""*" & Me.txtFilterReceiptTo
& "*"") AND"
End If
If Me.cboDonationPaid = "Paid" Then
strWhere = strWhere & "([ynDonationPaid] = True) AND"
ElseIf Me.cboDonationPaid = "Unpaid" Then
strWhere = strWhere & "([ynDonationPaid] = False) AND"
End If
If Not IsNull(Me.cboCampaign) Then
strWhere = strWhere & "([keyCampaign] = " & Me.cboCampaign & ") AND"
End If
lngLen = Len(strWhere) - 4
If lngLen <= 0 Then
MsgBox "No Criteria", vbInformation, "Nothing Entered"
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
I have a search form that I have been coding and testing with each filed
addition.
Everything worked perfectly until the last field (cboCampaign) was added.
Now I get a error 3075 extra ) in string. Any assistance is greatly
appreciated.
Cheers,
Tal
Here's the code:
Private Sub btnApplyFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterDonorName) Then
strWhere = strWhere & "([compFileAs] Like ""*" & Me.txtFilterDonorName &
"*"") AND"
End If
If Not IsNull(Me.txtFilterDonorAddress) Then
strWhere = strWhere & "([compAddress] Like ""*" &
Me.txtFilterDonorAddress & "*"") AND"
End If
If Not IsNull(Me.txtFilterDescription) Then
strWhere = strWhere & "([txtDescription] Like ""*" &
Me.txtFilterDescription & "*"") AND"
End If
If Not IsNull(Me.txtFilterReceiptTo) Then
strWhere = strWhere & "([txtReceiptTo] Like ""*" & Me.txtFilterReceiptTo
& "*"") AND"
End If
If Me.cboDonationPaid = "Paid" Then
strWhere = strWhere & "([ynDonationPaid] = True) AND"
ElseIf Me.cboDonationPaid = "Unpaid" Then
strWhere = strWhere & "([ynDonationPaid] = False) AND"
End If
If Not IsNull(Me.cboCampaign) Then
strWhere = strWhere & "([keyCampaign] = " & Me.cboCampaign & ") AND"
End If
lngLen = Len(strWhere) - 4
If lngLen <= 0 Then
MsgBox "No Criteria", vbInformation, "Nothing Entered"
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub