A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Fliter



 
 
Thread Tools Display Modes
  #1  
Old August 8th, 2009, 09:14 PM posted to microsoft.public.access.gettingstarted
Richard
external usenet poster
 
Posts: 1,419
Default 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  
Old August 8th, 2009, 09:58 PM posted to microsoft.public.access.gettingstarted
fredg
external usenet poster
 
Posts: 4,386
Default 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  
Old August 8th, 2009, 11:04 PM posted to microsoft.public.access.gettingstarted
Richard
external usenet poster
 
Posts: 1,419
Default 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  
Old August 8th, 2009, 11:08 PM posted to microsoft.public.access.gettingstarted
Richard
external usenet poster
 
Posts: 1,419
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.