special characters in Queries


G

Guest

I have a column that has department names in it. Some of the departments have
an apostrophe in the name. Some of the departments have a dash in them. When
I try to write a parameter query and type in the department with an
apostrophe or dash the query does not find a match. I cannot use a LIKE
expression in this query because I need exact matches for the departments. In
other words, I don't want the query to pull in departments that have similar
names. I took out the parameter and typed in the department with an
apostrophe in the criteria grid and still did not pull a match.
 
Ad

Advertisements

K

Ken Snell \(MVP\)

For ' character, double it up when you type it in. For example, if you want
to search for
O'Donnell

Type O''Donnell for the search.


For those other characters, surround them with [ ] brackets. So if you want
to search for
and/or

Type and[/]or for the search.
 
J

John Vinson

I have a column that has department names in it. Some of the departments have
an apostrophe in the name. Some of the departments have a dash in them. When
I try to write a parameter query and type in the department with an
apostrophe or dash the query does not find a match. I cannot use a LIKE
expression in this query because I need exact matches for the departments. In
other words, I don't want the query to pull in departments that have similar
names. I took out the parameter and typed in the department with an
apostrophe in the criteria grid and still did not pull a match.
Apostrophes don't cause problems *unless* you try to delimit the
paramter with apostrophes (single quotes, '); if you use " instead you
should have no problem. I don't think that a hyphen should cause any
problems either!

Could you post the SQL view of the query that you're running?

John W. Vinson[MVP]
 
Ad

Advertisements

G

Guest

I just realized that the department names that I typed in directly to the
Access database work correctly in the query. It is the department names that
were imported from a spreadsheet that do not work. They must have an
invisible, embedded character.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top