query to find all companies with a "-" in

  • Thread starter Thread starter Mavog
  • Start date Start date
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
 
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 "*-*"
 
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).
 
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) & "]*"
 
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 "*-*"
 
Back
Top