Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ApplyFilter using wildcard character

Status
Not open for further replies.

Watermelon

Programmer
Apr 16, 2001
68
US
Hi,

Does anyone know if it's possible to us a wildcard character
with the apply filter method? I tried this code below and I haven't had any luck.

DoCmd.ApplyFilter , "Model = 'txtKeyword*'"

The txtKeyword above refers to a textbox on my form
Thanks a ton for any help,
TM
 
Try this:

DoCmd.ApplyFilter , "Model = '" & txtKeyword & "*'"
Mike Rohde
rohdem@marshallengines.com
 
Hi Rodhem,

Thanks for your response. I did try your suggestion, but it doesn't seem to be working. It's not returning any data. Do you have any ideas why this wouldn't work?

Thanks again,
TM
 
I'm not sure if you can use 'like' in an applyfilter, but you might try:

DoCmd.ApplyFilter , "[Model] like '" & txtKeyword & "*'"
Mike Rohde
rohdem@marshallengines.com
 
Thanks Rodhem, that did do it. Unfortunately, I just realized that I was doing things the wrong way. I have
a form and subform. I want the user to enter a model # on the form and (using a wildcard search) I want this to bring back all the matching records on the subform. This is not a one to many relationship. There are many different model numbers on the master that I want to link to in the subform.

Do you know if this is possible?
Thanks again,
TM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top