'LIKE' query not working

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

In Access 2003, I'm trying to write a query using the Query Designer/SQL
window. Basically, I'm trying to execute a query with "LIKE" in it, with a
prompted value. However, the syntax doesn't seem to work, no matter what
permutations I try.

Example:

SELECT Table1.Field1
FROM Table1
WHERE (((Table1.Field1) Like [Prompt] & '%'));

That doesn't work.

WHERE (((Table1.Field1) Like '[Prompt]%'));

That doesn't work either

Any thoughts on how to construct this LIKE would sure be appreciated.

Thanks a bunch!
 
Jet uses the asterisk as the wildcard character:

LIKE [Prompt] & "*"

Ken Sheridan
Stafford, England
 
Geez. Leave it to me to "over-SQL" my attempt at a solution. That worked
perfectly.

Thanks!



Ken Sheridan said:
Jet uses the asterisk as the wildcard character:

LIKE [Prompt] & "*"

Ken Sheridan
Stafford, England

Dennis said:
In Access 2003, I'm trying to write a query using the Query Designer/SQL
window. Basically, I'm trying to execute a query with "LIKE" in it, with a
prompted value. However, the syntax doesn't seem to work, no matter what
permutations I try.

Example:

SELECT Table1.Field1
FROM Table1
WHERE (((Table1.Field1) Like [Prompt] & '%'));

That doesn't work.

WHERE (((Table1.Field1) Like '[Prompt]%'));

That doesn't work either

Any thoughts on how to construct this LIKE would sure be appreciated.

Thanks a bunch!
 
Dennis said:
In Access 2003, I'm trying to write a query using the Query Designer/SQL
window. Basically, I'm trying to execute a query with "LIKE" in it, with a
prompted value. However, the syntax doesn't seem to work, no matter what
permutations I try.

Example:

SELECT Table1.Field1
FROM Table1
WHERE (((Table1.Field1) Like [Prompt] & '%'));

That doesn't work.

WHERE (((Table1.Field1) Like '[Prompt]%'));

That doesn't work either

Any thoughts on how to construct this LIKE would sure be appreciated.


WHERE Table1.Field1 Like [Prompt] & '%'
is legal in some versions of SQL (ADO, Ansi92, SQL Server,
etc), but the usual DAO wildcard is * instead of %
 
Back
Top