Filter error 2185

sweeneytime

New member
Local time
Tomorrow, 04:54
Joined
Oct 9, 2012
Messages
9
Hi Guys,

I have a piece of code for a text filter on my form. I am now getting an error "2185, You can't reference a property or method for a control unless the control has focus." The strange thing is that it worked yesterday but not today! In googling people say to remove the .text in my (me.txtfilter.text) but this doesn't appear to work.

Any suggestion would be appreciated.

Code:
Private Sub txtFilter_Change()

    If Nz(Me.txtFilter.Text, "") = "" Then
        Me.FilterOn = False
        Me.txtFilter.SetFocus
        Exit Sub
    End If
    Me.txtFilter = "[Second Name] like '" + Me.txtFilter.Text + "%' or [First Name] like '" & _
        Me.txtFilter.Text + "%'"
    Me.FilterOn = True
    Me.txtFilter.SetFocus
    Me.txtFilter.SelStart = Len(Nz(Me.txtFilter.Text, "")) + 1


End Sub
 
Try not using the .Text property.
 

Users who are viewing this thread

Back
Top Bottom