Search

ofernad

New member
Local time
Today, 04:37
Joined
Dec 22, 2003
Messages
6
serch macro

hi
I have a form and adatasheet subform that contain a cutomers list
in the form i type a name of a customer and the list filtered to the customers that contan the string i typed
i use SelectObject and select the sub form and i use ApplyFilter but it will not work
please help
 
Try using vba instead of a macro. And search the forum for it. Multi upon multi samples out there.

Regards

P.S. Welcom to the forum
 
In VB it is not a problem at all

In vb i cant use characters as " ' "
and in macro Ii can
if you can tell me how to use in an sql the char ' them I will not use the macro
Thank You
Ofer
 
Yes you can.... same way as the macro....
 
Sorry but no

Me.SubCustSerch.Form.Filter = "CUST_NAME like '" & temp & "'"

if temp contains the word can't its an error
 
full code

Dim temp As String
temp = "*" & TxtCust.Text & "*"
If Not (TxtCust.Text = "") Then
Me.SubCustSerch.Form.Filter = "CUST_NAME like '" & temp & "'"
Me.SubCustSerch.Form.FilterOn = True
Else: Me.SubCustSerch.Form.FilterOn = False
End If
 
well use something like:

Me.SubCustSerch.Form.Filter = "CUST_NAME like " & chr(34) & temp & chr(34)
Or
Me.SubCustSerch.Form.Filter = "CUST_NAME like """ & temp & """"

both basicaly give the same result.... (chr(34) = ")

Hope that helps you along.

Regards
 
If the temp contain the word can't then the sql is like this

.........CUST_NAME like ' can't ' ...........

and that is an erro
try it
the macro solve if nicely
but i cant put the temp value when running
 
your right but if you look at my previous post you will see that i replaced the ' by " in the sql statement.

Thus.... CUST_NAME like "*can't*" ........... is the end result which can be resolved.....

Good luck
 
thank you for the answers

I will continue serching because i'm sure that with macro it will be very simple
thank you
Ofer from israel
p.s
Im developing with VB and access since 98 and it is the first time I receved a good respons from forums
if you have a probelem I will be happy to help
 
Search problem

Hi,

I have the same problem as you on search, on the last thread on 23 December. Did you find the solution? I have try your vb full codes on my form and it didn't work. I need help.

Full code

Private sub TxtCust_change()
Dim temp As String
temp = "*" & TxtCust.Text & "*"
If Not (TxtCust.Text = "") Then
Me.SubCustSerch.Form.Filter = "CUST_NAME like '" & temp & "'"
Me.SubCustSerch.Form.FilterOn = True
Else Me.SubCustSerch.Form.FilterOn = False
End If

End sub

Thanks,

Le
 

Users who are viewing this thread

Back
Top Bottom