Re: Using LIKE in SQL (Repost, still need help)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

anonymous_at_discussions.microsoft.com
Date: 07/21/04


Date: Wed, 21 Jul 2004 10:41:17 -0700

Answered in a post below, nevermind.

>-----Original Message-----
>oops, there is not an error. It just returns a
recordset
>with no records. But when I run the query in the SQL
>builder, I get the correct results.
>
>The syntax error, "Syntax error (missing operator) in
>query expression '(((ACCOUNT_LIST.COMPLEMENTOR) LIKE
>*'A'*))'." occurs when the last line is:
>WHERE (((ACCOUNT_LIST.COMPLEMENTOR) LIKE *'A'*))
>
>Any idea why my recordset is blank?
>
>
>>-----Original Message-----
>>What is the error?
>>"Brian" <Brian@discussions.microsoft.com> wrote in
>message
>>news:165301c46f37$1d768ed0$a501280a@phx.gbl...
>>> Hello. Sorry this is kinda long, but I don't know how
>>> else to tell you my problem.
>>>
>>> I want to use the LIKE command to search for records
>that
>>> contain parts of words in a given field. I construct
>the
>>> SQL in the query builder and get the following:
>>>
>>> SELECT ACCOUNT_LIST.COMPLEMENTOR, ACCOUNT_LIST.ID,
>>> ACCOUNT_LIST.ACCOUNT_NAME, REP_LIST.REP_NAME,
>>> CS_LIST.CS_NAME, ACCOUNT_LIST.CAT,
>>> ACCOUNT_LIST.MARKET_AREA, ACCOUNT_LIST.MAKER_LOC,
>>> ACCOUNT_LIST.STATE, ACCOUNT_LIST.AGENCY_NAME,
>>> ACCOUNT_LIST.PENDING, ACCOUNT_LIST.ADDED,
>>> ACCOUNT_LIST.IHD, ACCOUNT_LIST.CODE, ACCOUNT_LIST.OUT,
>>> ACCOUNT_LIST.REMARKS
>>> FROM REP_LIST INNER JOIN (CS_LIST INNER JOIN
>ACCOUNT_LIST
>>> ON CS_LIST.id = ACCOUNT_LIST.CS) ON REP_LIST.id =
>>> ACCOUNT_LIST.REP
>>> WHERE (((ACCOUNT_LIST.COMPLEMENTOR) Like "*A*"));
>>>
>>> I want to take this and pass it through the rst.Open
>>> method. I have named the varible containing the SQL
>>> statement: strsearch.
>>>
>>> The statement i have used to execute this is :
>>> rst.Open strsearch
>>>
>>> And strsearch is equal to:
>>>
>>> SELECT ACCOUNT_LIST.COMPLEMENTOR, ACCOUNT_LIST.ID,
>>> ACCOUNT_LIST.ACCOUNT_NAME, REP_LIST.REP_ID,
>>> CS_LIST.CS_ID, ACCOUNT_LIST.CAT,
>>> ACCOUNT_LIST.MARKET_AREA, ACCOUNT_LIST.MAKER_LOC,
>>> ACCOUNT_LIST.STATE, ACCOUNT_LIST.AGENCY_NAME,
>>> ACCOUNT_LIST.PENDING, ACCOUNT_LIST.ADDED,
>>> ACCOUNT_LIST.IHD, ACCOUNT_LIST.CODE, ACCOUNT_LIST.OUT,
>>> ACCOUNT_LIST.REMARKS, ACCOUNT_LIST.ident FROM REP_LIST
>>> INNER JOIN (CS_LIST INNER JOIN ACCOUNT_LIST ON
>CS_LIST.id
>>> = ACCOUNT_LIST.CS) ON REP_LIST.id = ACCOUNT_LIST.REP
>>> WHERE (((ACCOUNT_LIST.COMPLEMENTOR) LIKE '*A*'))
>>>
>>> The last line is where i am having the problem. I
get
>a
>>> syntax error here. Any idea how my syntax is wrong?
>If
>>> i say (for the last line):
>>>
>>> WHERE (((ACCOUNT_LIST.COMPLEMENTOR)='A'))
>>>
>>> it gives me no syntax error, so I'm thinking the
>problem
>>> is not with my use of single quotes('). Any ideas?
>>> Thanks is advance!!
>>>
>>> Brian
>>
>>
>>.
>>
>..
>
>
>.
>



Relevant Pages

  • Re: Help with Microsoft help on linking Access to Outlook
    ... Tools - references - tick Microsoft Outlook object library. ... in the criteria cell in the graphical query builder. ... the same filtered recordset every time. ... normal form to allow the normal filtering process and viewing of the ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... in the criteria cell in the graphical query builder. ... use as the source in the routine. ... the same filtered recordset every time. ... normal form to allow the normal filtering process and viewing of the ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... and have the query point to the combo box to get its value. ... the same filtered recordset every time. ... choose themselves what fields to filter on. ... Set MyRS = MyDB.OpenRecordset" ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... in the criteria cell in the graphical query builder. ... use as the source in the routine. ... the same filtered recordset every time. ... normal form to allow the normal filtering process and viewing of the ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... in the criteria cell in the graphical query builder. ... use as the source in the routine. ... the same filtered recordset every time. ... choose themselves what fields to filter on. ...
    (microsoft.public.access.formscoding)