C
Cam
Hello,
I have a multiple criteria fields to filter records. I used the concept used
by Allen Brown example. But when I select multiple fields to filter, it gave
me this error.
Thanks for any help in resolving the problem.
Run-time error '2448':
You can't assign a value to this object.
Here is my VBA code.
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.cboAP) Then
strWhere = strWhere & "([AP] = " & Me.cboAP & ") AND "
End If
If Not IsNull(Me.cboProdCode) Then
strWhere = strWhere & "([ProductCode] = " & Me.cboProdCode & ") AND "
End If
If Not IsNull(Me.cboWC) Then
strWhere = strWhere & "([WC] = " & Me.cboWC & ") AND "
End If
If Not IsNull(Me.cboWCDesc) Then
strWhere = strWhere & "([WCDesc] = " & Me.cboWCDesc & ") AND "
End If
If Not IsNull(Me.txtParentPart) Then
strWhere = strWhere & "([ParentPart] Like ""*" & Me.txtParentPart &
"*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
End Select
Next
Me.FilterOn = False
End Sub
I have a multiple criteria fields to filter records. I used the concept used
by Allen Brown example. But when I select multiple fields to filter, it gave
me this error.
Thanks for any help in resolving the problem.
Run-time error '2448':
You can't assign a value to this object.
Here is my VBA code.
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.cboAP) Then
strWhere = strWhere & "([AP] = " & Me.cboAP & ") AND "
End If
If Not IsNull(Me.cboProdCode) Then
strWhere = strWhere & "([ProductCode] = " & Me.cboProdCode & ") AND "
End If
If Not IsNull(Me.cboWC) Then
strWhere = strWhere & "([WC] = " & Me.cboWC & ") AND "
End If
If Not IsNull(Me.cboWCDesc) Then
strWhere = strWhere & "([WCDesc] = " & Me.cboWCDesc & ") AND "
End If
If Not IsNull(Me.txtParentPart) Then
strWhere = strWhere & "([ParentPart] Like ""*" & Me.txtParentPart &
"*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
End Select
Next
Me.FilterOn = False
End Sub