H
Hiro
Hello Forum Members:
I have the following filters on the form and found out some filters are not
working while the other filters are working.
The filters that are NOT working are:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
If Not IsNull(Me.FindSize1) Then
strWhere = strWhere & "([JawsSize] >= " & Format(Me.FindSize1) & ")
AND "
End If
If Not IsNull(Me.FindSize2) Then 'Less than the next day.
strWhere = strWhere & "([JawsSize] < " & Format(Me.FindSize2 + 1) &
") AND "
End If
If Not IsNull(Me.FindLength1) Then
strWhere = strWhere & "([Length] >= " & Format(Me.FindLength1) & ")
AND "
End If
If Not IsNull(Me.FindLength2) Then 'Less than the next day.
strWhere = strWhere & "([Length] < " & Format(Me.FindLength2 + 1) &
") AND "
End If
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
What am I doing wrong? Can anybody see what is causing this problem?
And this the entire code.
[starts here.]
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.FindCompany) Then
strWhere = strWhere & "([CompanyName] Like " & Me.FindCompany & ")
AND "
End If
If Not IsNull(Me.FindProduct) Then
strWhere = strWhere & "([ProductName] Like " & Me.FindProduct & ")
AND "
End If
If Not IsNull(Me.FindVolume) Then
strWhere = strWhere & "([JawsVolume] Like " & Me.FindVolume & ") AND "
End If
If Not IsNull(Me.FindSize) Then
strWhere = strWhere & "([JawsSize] Like " & Me.FindSize & ") AND "
End If
If Me.cboFilterFenestrated = 0 Then
strWhere = strWhere & "([JawsFenestrated] = True) AND "
ElseIf Me.cboFilterFenestrated = 1 Then
strWhere = strWhere & "([JawsFenestrated] = False) AND "
End If
If Not IsNull(Me.FindSheath) Then
strWhere = strWhere & "([SheathSize] Like " & Me.FindSheath & ") AND "
End If
If Not IsNull(Me.FindLength) Then
strWhere = strWhere & "([Length] Like " & Me.FindLength & ") AND "
End If
If Me.cboFilterFormable = 0 Then
strWhere = strWhere & "([Formable] = True) AND "
ElseIf Me.cboFilterFormable = 1 Then
strWhere = strWhere & "([Formable] = False) AND "
End If
If Me.cboFilterFEP = 0 Then
strWhere = strWhere & "([FEP] = True) AND "
ElseIf Me.cboFilterFEP = 1 Then
strWhere = strWhere & "([FEP] = False) AND "
End If
If Not IsNull(Me.FindSize1) Then
strWhere = strWhere & "([JawsSize] >= " & Format(Me.FindSize1) & ")
AND "
End If
If Not IsNull(Me.FindSize2) Then 'Less than the next day.
strWhere = strWhere & "([JawsSize] < " & Format(Me.FindSize2 + 1) &
") AND "
End If
If Not IsNull(Me.FindLength1) Then
strWhere = strWhere & "([Length] >= " & Format(Me.FindLength1) & ")
AND "
End If
If Not IsNull(Me.FindLength2) Then 'Less than the next day.
strWhere = strWhere & "([Length] < " & Format(Me.FindLength2 + 1) &
") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Nothing is specified.", vbInformation, "Nothing to show."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
[ends here.]
With best regards,
Hiro
I have the following filters on the form and found out some filters are not
working while the other filters are working.
The filters that are NOT working are:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
If Not IsNull(Me.FindSize1) Then
strWhere = strWhere & "([JawsSize] >= " & Format(Me.FindSize1) & ")
AND "
End If
If Not IsNull(Me.FindSize2) Then 'Less than the next day.
strWhere = strWhere & "([JawsSize] < " & Format(Me.FindSize2 + 1) &
") AND "
End If
If Not IsNull(Me.FindLength1) Then
strWhere = strWhere & "([Length] >= " & Format(Me.FindLength1) & ")
AND "
End If
If Not IsNull(Me.FindLength2) Then 'Less than the next day.
strWhere = strWhere & "([Length] < " & Format(Me.FindLength2 + 1) &
") AND "
End If
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
What am I doing wrong? Can anybody see what is causing this problem?
And this the entire code.
[starts here.]
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.FindCompany) Then
strWhere = strWhere & "([CompanyName] Like " & Me.FindCompany & ")
AND "
End If
If Not IsNull(Me.FindProduct) Then
strWhere = strWhere & "([ProductName] Like " & Me.FindProduct & ")
AND "
End If
If Not IsNull(Me.FindVolume) Then
strWhere = strWhere & "([JawsVolume] Like " & Me.FindVolume & ") AND "
End If
If Not IsNull(Me.FindSize) Then
strWhere = strWhere & "([JawsSize] Like " & Me.FindSize & ") AND "
End If
If Me.cboFilterFenestrated = 0 Then
strWhere = strWhere & "([JawsFenestrated] = True) AND "
ElseIf Me.cboFilterFenestrated = 1 Then
strWhere = strWhere & "([JawsFenestrated] = False) AND "
End If
If Not IsNull(Me.FindSheath) Then
strWhere = strWhere & "([SheathSize] Like " & Me.FindSheath & ") AND "
End If
If Not IsNull(Me.FindLength) Then
strWhere = strWhere & "([Length] Like " & Me.FindLength & ") AND "
End If
If Me.cboFilterFormable = 0 Then
strWhere = strWhere & "([Formable] = True) AND "
ElseIf Me.cboFilterFormable = 1 Then
strWhere = strWhere & "([Formable] = False) AND "
End If
If Me.cboFilterFEP = 0 Then
strWhere = strWhere & "([FEP] = True) AND "
ElseIf Me.cboFilterFEP = 1 Then
strWhere = strWhere & "([FEP] = False) AND "
End If
If Not IsNull(Me.FindSize1) Then
strWhere = strWhere & "([JawsSize] >= " & Format(Me.FindSize1) & ")
AND "
End If
If Not IsNull(Me.FindSize2) Then 'Less than the next day.
strWhere = strWhere & "([JawsSize] < " & Format(Me.FindSize2 + 1) &
") AND "
End If
If Not IsNull(Me.FindLength1) Then
strWhere = strWhere & "([Length] >= " & Format(Me.FindLength1) & ")
AND "
End If
If Not IsNull(Me.FindLength2) Then 'Less than the next day.
strWhere = strWhere & "([Length] < " & Format(Me.FindLength2 + 1) &
") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Nothing is specified.", vbInformation, "Nothing to show."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
[ends here.]
With best regards,
Hiro