Re: Using LIKE in SQL (Repost, still need help)
anonymous_at_discussions.microsoft.com
Date: 07/21/04
- Next message: Brian: "Re: Using LIKE in SQL"
- Previous message: Tim Ferguson: "Re: Customized Error Message"
- In reply to: Brian: "Re: Using LIKE in SQL (Repost, still need help)"
- Next in thread: Steve: "Re: Using LIKE in SQL (Repost, still need help)"
- Messages sorted by: [ date ] [ thread ]
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
>>
>>
>>.
>>
>..
>
>
>.
>
- Next message: Brian: "Re: Using LIKE in SQL"
- Previous message: Tim Ferguson: "Re: Customized Error Message"
- In reply to: Brian: "Re: Using LIKE in SQL (Repost, still need help)"
- Next in thread: Steve: "Re: Using LIKE in SQL (Repost, still need help)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|