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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

filter words



 
 
Thread Tools Display Modes
  #1  
Old December 6th, 2006, 08:57 PM posted to microsoft.public.access.forms
GGill
external usenet poster
 
Posts: 48
Default filter words

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you
  #2  
Old December 6th, 2006, 09:35 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default filter words


Me.Form.Filter = "Left([Name], Len(Me.Text96)) = '" & Me![Text96] &
"'"
Me.FilterOn = True

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #3  
Old December 6th, 2006, 09:36 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default filter words

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #4  
Old December 7th, 2006, 05:13 AM posted to microsoft.public.access.forms
GGill
external usenet poster
 
Posts: 48
Default filter words

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #5  
Old December 7th, 2006, 01:49 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default filter words

No, Len does not need to declared. It is a VBA function.
What error are you getting?
Also, the names I used may not be the correct names. Is Text96 the name of
the control on your form? Is Name the name of the field in the form's record
source?

Using Name as a name is not good. It is an Access Reserved workd and can be
a problem. No reserved words should be used in names (Name, Date, Year, etc.)

"GGill" wrote:

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #6  
Old December 13th, 2006, 10:49 PM posted to microsoft.public.access.forms
GGill
external usenet poster
 
Posts: 48
Default filter words

Actually the Name in my form call 'FullNm', it is record source.
Text96 is unbound text box, where i type any thing to filter. When i click
on command button to filter it will pop-up small window 'Enter parameter
value me.Text96', if i enter parameter the code works, but if i don't enter,
then i have messaage error 'You canceled the previos operation'.

Also if i do filter and i don't have any records, then form will be blank.
where should i add to my code (MsgBox "No Records").

Thank you so much for helping.

"Klatuu" wrote:

No, Len does not need to declared. It is a VBA function.
What error are you getting?
Also, the names I used may not be the correct names. Is Text96 the name of
the control on your form? Is Name the name of the field in the form's record
source?

Using Name as a name is not good. It is an Access Reserved workd and can be
a problem. No reserved words should be used in names (Name, Date, Year, etc.)

"GGill" wrote:

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #7  
Old December 13th, 2006, 11:04 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default filter words

You should refer to the control in the criteria for the field you are
filtering on in your query. The query does not understand Me. Me only works
in the current form. It should be entered as:
Forms!FullNm!Text96

If you want to present a message saying there are no matching records, you
will have to use a DCount function to determine if there are matching
records. You can use the query you are using to return records in the DCount:

If DCount("*", "MyQueryName") = 0 Then
MsgBox "No Matching Records"
Else
'Do whatever you are doing now to return the records
End If

"GGill" wrote:

Actually the Name in my form call 'FullNm', it is record source.
Text96 is unbound text box, where i type any thing to filter. When i click
on command button to filter it will pop-up small window 'Enter parameter
value me.Text96', if i enter parameter the code works, but if i don't enter,
then i have messaage error 'You canceled the previos operation'.

Also if i do filter and i don't have any records, then form will be blank.
where should i add to my code (MsgBox "No Records").

Thank you so much for helping.

"Klatuu" wrote:

No, Len does not need to declared. It is a VBA function.
What error are you getting?
Also, the names I used may not be the correct names. Is Text96 the name of
the control on your form? Is Name the name of the field in the form's record
source?

Using Name as a name is not good. It is an Access Reserved workd and can be
a problem. No reserved words should be used in names (Name, Date, Year, etc.)

"GGill" wrote:

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #8  
Old December 13th, 2006, 11:25 PM posted to microsoft.public.access.forms
GGill
external usenet poster
 
Posts: 48
Default filter words

FullNm is control sourse in my text box Nm,Text96 is unbound text box name,
control source in Text96 is nothig.
Instead of Me.Text96, what should i us in my code.
"Klatuu" wrote:

You should refer to the control in the criteria for the field you are
filtering on in your query. The query does not understand Me. Me only works
in the current form. It should be entered as:
Forms!FullNm!Text96

If you want to present a message saying there are no matching records, you
will have to use a DCount function to determine if there are matching
records. You can use the query you are using to return records in the DCount:

If DCount("*", "MyQueryName") = 0 Then
MsgBox "No Matching Records"
Else
'Do whatever you are doing now to return the records
End If

"GGill" wrote:

Actually the Name in my form call 'FullNm', it is record source.
Text96 is unbound text box, where i type any thing to filter. When i click
on command button to filter it will pop-up small window 'Enter parameter
value me.Text96', if i enter parameter the code works, but if i don't enter,
then i have messaage error 'You canceled the previos operation'.

Also if i do filter and i don't have any records, then form will be blank.
where should i add to my code (MsgBox "No Records").

Thank you so much for helping.

"Klatuu" wrote:

No, Len does not need to declared. It is a VBA function.
What error are you getting?
Also, the names I used may not be the correct names. Is Text96 the name of
the control on your form? Is Name the name of the field in the form's record
source?

Using Name as a name is not good. It is an Access Reserved workd and can be
a problem. No reserved words should be used in names (Name, Date, Year, etc.)

"GGill" wrote:

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

  #9  
Old December 14th, 2006, 02:07 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default filter words

In your previous post, you said FullNm is the name of the form.

I'm getting really confused here. If Text96 is a unbound text box and you
want to search on the value in that text box, the syntax is

Forms!NameOfForm!Text96

"GGill" wrote:

FullNm is control sourse in my text box Nm,Text96 is unbound text box name,
control source in Text96 is nothig.
Instead of Me.Text96, what should i us in my code.
"Klatuu" wrote:

You should refer to the control in the criteria for the field you are
filtering on in your query. The query does not understand Me. Me only works
in the current form. It should be entered as:
Forms!FullNm!Text96

If you want to present a message saying there are no matching records, you
will have to use a DCount function to determine if there are matching
records. You can use the query you are using to return records in the DCount:

If DCount("*", "MyQueryName") = 0 Then
MsgBox "No Matching Records"
Else
'Do whatever you are doing now to return the records
End If

"GGill" wrote:

Actually the Name in my form call 'FullNm', it is record source.
Text96 is unbound text box, where i type any thing to filter. When i click
on command button to filter it will pop-up small window 'Enter parameter
value me.Text96', if i enter parameter the code works, but if i don't enter,
then i have messaage error 'You canceled the previos operation'.

Also if i do filter and i don't have any records, then form will be blank.
where should i add to my code (MsgBox "No Records").

Thank you so much for helping.

"Klatuu" wrote:

No, Len does not need to declared. It is a VBA function.
What error are you getting?
Also, the names I used may not be the correct names. Is Text96 the name of
the control on your form? Is Name the name of the field in the form's record
source?

Using Name as a name is not good. It is an Access Reserved workd and can be
a problem. No reserved words should be used in names (Name, Date, Year, etc.)

"GGill" wrote:

I have message error, i think problem with this 'Len(Me.Text96))'
May be i need declare Len, i am not sure, but this code is not working

"Klatuu" wrote:

Sorry, take the Form out.
Instead of
Me.Form.Filter
Use
Me.Filter

"GGill" wrote:

In my form i have text box 'Filter' and command button 'Find'.
If i type in my text box 'Filter' 1 or more letters and click on 'Find'
button it will find records in my form. but it also filtering inside word. I
will need to able filter only begining of each word. If i have in my field
'Name' column 3 words it should filter only begining of each words.
Here is my code:

Set rs = Me.Recordset.Clone
Me.FilterOn = True
Me.Form.Filter = "[Name] like '*' + '" & Me![Text96] & "' + '*'"
===============================================
Please help me.
Thank you

 




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 09:35 AM.


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