S
sept2006
When I enter criteria (a for example) and hit the filter button that I
created on the form, a message box displays, Run-Time Error ‘2448’: You
can’t assign a value to this object.
When I Debug the code (I tried the Debug.Print cmd), ([TOOL NO]) Like
"*a*") appears in the immediate window. When I scroll my pointer over
Me.Filter = strWhere, it says Me.Filter = “([TOOL NO]) Like "*a*")â€.
This form is pulling information from two tables. The main table gives most
of the information about the Tool (desc, item no, owned by, etc..), and the
other table includes only the Tool No and the Location so that I can clear
out that information every year when we run a new inventory (which will also
allow me to save the previous location). The two tables have a one to one
relationship, so I did not think that it should be a problem. Does anybody
know what I may be wrong?
Thanks,
sept2006
Code for Filter_Click() is below,
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterToolNo) Then
strWhere = strWhere & "([TOOL NO]) Like ""*" & Me.txtFilterToolNo &
"*"") AND "
End If
If Not IsNull(Me.txtFilterItemNo) Then
strWhere = strWhere & "([ITEM NO]) Like ""*" & Me.txtFilterItemNo &
"*"") AND "
End If
If Not IsNull(Me.txtFilterOwnedBy) Then
strWhere = strWhere & "([OWNED BY]) Like ""*" & Me.txtFilterOwnedBy
& "*"") AND "
End If
If Not IsNull(Me.txtFilterComments) Then
strWhere = strWhere & "([COMMENTS]) Like ""*" & Me.txtFilterComments
& "*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria.", vbInformation, "Cannot narrow Results."
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
'(Code is referenced from Allen Browne, http://allenbrowne.com/ser-62.html)
created on the form, a message box displays, Run-Time Error ‘2448’: You
can’t assign a value to this object.
When I Debug the code (I tried the Debug.Print cmd), ([TOOL NO]) Like
"*a*") appears in the immediate window. When I scroll my pointer over
Me.Filter = strWhere, it says Me.Filter = “([TOOL NO]) Like "*a*")â€.
This form is pulling information from two tables. The main table gives most
of the information about the Tool (desc, item no, owned by, etc..), and the
other table includes only the Tool No and the Location so that I can clear
out that information every year when we run a new inventory (which will also
allow me to save the previous location). The two tables have a one to one
relationship, so I did not think that it should be a problem. Does anybody
know what I may be wrong?
Thanks,
sept2006
Code for Filter_Click() is below,
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterToolNo) Then
strWhere = strWhere & "([TOOL NO]) Like ""*" & Me.txtFilterToolNo &
"*"") AND "
End If
If Not IsNull(Me.txtFilterItemNo) Then
strWhere = strWhere & "([ITEM NO]) Like ""*" & Me.txtFilterItemNo &
"*"") AND "
End If
If Not IsNull(Me.txtFilterOwnedBy) Then
strWhere = strWhere & "([OWNED BY]) Like ""*" & Me.txtFilterOwnedBy
& "*"") AND "
End If
If Not IsNull(Me.txtFilterComments) Then
strWhere = strWhere & "([COMMENTS]) Like ""*" & Me.txtFilterComments
& "*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria.", vbInformation, "Cannot narrow Results."
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
'(Code is referenced from Allen Browne, http://allenbrowne.com/ser-62.html)