Fliter

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi all,

Im trying to fliter my form using a unbound textbox and a command button. If
the user inputs a partial string or exact string, either way i want the
results to filter.

Private Sub cmdPhoneNumber_Click()
' Find the record that matches the control.
Dim stFilter As String

Me.FilterOn = False

stFilter = [Phone] Like "*" & Me.txtPhoneNumber & "*"


Me.Filter = stFilter
Me.FilterOn = True

End Sub

I can't seem to get this to filter correctly.

Richard
 
Hi all,

Im trying to fliter my form using a unbound textbox and a command button. If
the user inputs a partial string or exact string, either way i want the
results to filter.

Private Sub cmdPhoneNumber_Click()
' Find the record that matches the control.
Dim stFilter As String

Me.FilterOn = False

stFilter = [Phone] Like "*" & Me.txtPhoneNumber & "*"


Me.Filter = stFilter
Me.FilterOn = True

End Sub

I can't seem to get this to filter correctly.

Richard

The Filter must be a string.

strFilter = "[Phone] Like '*" & Me.[txtPhoneNumber] & "*'"
 
Hi Fred

I changed this line as per your suggestion, but now I get a compile error:
variable not defined.

strFilter = "[Phone] Like '*" & Me.[txtPhoneNumber] & "*'"



fredg said:
Hi all,

Im trying to fliter my form using a unbound textbox and a command button. If
the user inputs a partial string or exact string, either way i want the
results to filter.

Private Sub cmdPhoneNumber_Click()
' Find the record that matches the control.
Dim stFilter As String

Me.FilterOn = False

stFilter = [Phone] Like "*" & Me.txtPhoneNumber & "*"


Me.Filter = stFilter
Me.FilterOn = True

End Sub

I can't seem to get this to filter correctly.

Richard

The Filter must be a string.

strFilter = "[Phone] Like '*" & Me.[txtPhoneNumber] & "*'"
 
Never mind

You added an "R" to stFilter now it works great thanks Fred.



fredg said:
Hi all,

Im trying to fliter my form using a unbound textbox and a command button. If
the user inputs a partial string or exact string, either way i want the
results to filter.

Private Sub cmdPhoneNumber_Click()
' Find the record that matches the control.
Dim stFilter As String

Me.FilterOn = False

stFilter = [Phone] Like "*" & Me.txtPhoneNumber & "*"


Me.Filter = stFilter
Me.FilterOn = True

End Sub

I can't seem to get this to filter correctly.

Richard

The Filter must be a string.

strFilter = "[Phone] Like '*" & Me.[txtPhoneNumber] & "*'"
 
Back
Top