query to find all companies with a "-" in

M

Mavog

Hi all,
could someone please help me out, I'm trying to query the company
table to find all companies that have been spelt with a dash(-) in the
Compname field(e.g. Marble-Stone Ltd). I'm a bit of a newbie to
acess2003 but I've done some Sql programming years ago- hence i've
been lumbered with this task.

thanks in advance,
m
 
R

Rick Brandt

Mavog said:
Hi all,
could someone please help me out, I'm trying to query the company
table to find all companies that have been spelt with a dash(-) in the
Compname field(e.g. Marble-Stone Ltd). I'm a bit of a newbie to
acess2003 but I've done some Sql programming years ago- hence i've
been lumbered with this task.

SELECT * FROM company
WHERE Compname LIKE "*-*"
 
F

Fredg

Here are 2 ways.
To hard code the criteria...
As criteria in the [CompanyName] field:
Like "*-*"
Or
InStr([CompanyName],"-") > 0

To give the user a choice of Company names:
Like "*" & [Search for?] & "*"

You will be prompted for the name (or part of the name).
 
B

Brian Camire

You might use the following criteria on the Compname field:

Like "*-*"

If you also want to test for so-called "en" dashes and "em" dashes (Windows
characters 150 and 151, respectively), you might instead use the following
criteria on the Compname field:

Like "*[-" & Chr(150) & Chr(151) & "]*"
 
J

John Vinson

Hi all,
could someone please help me out, I'm trying to query the company
table to find all companies that have been spelt with a dash(-) in the
Compname field(e.g. Marble-Stone Ltd). I'm a bit of a newbie to
acess2003 but I've done some Sql programming years ago- hence i've
been lumbered with this task.

Try a criterion of

LIKE "*-*"
 

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