If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Fliter
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 |
#2
|
|||
|
|||
Fliter
On Sat, 8 Aug 2009 13:14:01 -0700, Richard wrote:
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] & "*'" -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Fliter
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" wrote: On Sat, 8 Aug 2009 13:14:01 -0700, Richard wrote: 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] & "*'" -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#4
|
|||
|
|||
Fliter
Never mind
You added an "R" to stFilter now it works great thanks Fred. "fredg" wrote: On Sat, 8 Aug 2009 13:14:01 -0700, Richard wrote: 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] & "*'" -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|