[AccessD] SQL "Like" question.

Bobby Heid bheid at appdevgrp.com
Fri Jun 24 13:16:56 CDT 2005


Thanks.  I did not even think about it in terms of enclosing table names.  I
already handle the tick mark thingy.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lonnie Johnson
Sent: Friday, June 24, 2005 11:17 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] SQL "Like" question.


Yes, the brackets are reserved for enclosing table, query and field names.
You may also want to look out for the tick mark or single quotation mark
('). This can trick your code to thinking you have jumped out of the SQL
String. For example the name O'Hare.

Bobby Heid <bheid at appdevgrp.com> wrote:Hey,

I have a search screen for an app that has several combo boxes that when the
user clicks the Find button, it builds a SQL query based upon the criteria
that the users have selected. The user can also use wild cards in the combo
boxes such as 'Carlton*'. Since they can use wild cards, I use LIKE when
building the SQL statement.

I got an email from a user today asking why a given project search was
returning no records. I looked at the data and this is what they were
searching for: 'Carlton [D]'. I suspected the data so I removed the brackets
from around the 'D' and the query worked fine.

My question is, is the bracket a special character? Are there other
characters that I need to watch out for? I know about the wild card
characters '*', '?', and the '#' character.

Thanks,
Bobby




More information about the AccessD mailing list