?
Solved

Me.Filter Query question

Posted on 2011-04-25
2
Medium Priority
?
576 Views
Last Modified: 2012-05-11
What am I doing wrong with the strFilter portion of this code.  I get the attached error everytime.
I am trying to filter the records to only get records with LIKE results in the column called Description.  In the test I was looking for the word GOD.

strFilter = "Description LIKE '" & strSearch '"
Me.Filter = strFilter
Me.FilterOn = True
 Error message Error message
0
Comment
Question by:sfn149
2 Comments
 
LVL 75
ID: 35460896
Try this:

strFilter = "[Description] = " & Chr(34)  & strSearch & Chr(34)
Me.Filter = strFilter
Me.FilterOn = True

mx
0
 
LVL 49

Accepted Solution

by:
Dale Fye earned 1000 total points
ID: 35460944
or if you really mean 'GOD' imbedded anywhere within the [Description] field, then try:

strFilter = "[Description] like '*" & strSearch & "*'"
me.filter = strFilter
me.FilterOn = true

Dale
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question