Searching for a digit or letter only

G

Grd

HI there,

I need to query a product_code which is a text column. I want all results
where:
The first 'letter' is a 6.
The second letter must be a letter (not a number).
The third has to be a letter or number i.e. The product code has to be 3
characters long.

Could someone help with the criteria needed for this.

Any help would be greatly appreciated.

Tx

Suzanne
 
X

XPS350

HI there,

I need to query a product_code which is a text column. I want all results
where:
The first 'letter' is a 6.
The second letter must be a letter (not a number).
The third has to be a letter or number i.e. The product code has to be 3
characters long.

Could someone help with the criteria needed for this.

Any help would be greatly appreciated.

Tx

Suzanne

That would look like:

SELECT * FROM YourTabel
WHERE Left(product_code,1)="6" AND NOT IsNumeric(Mid(product_code,
2,1)) AND Len(product_code)=3

Groeten,

Peter
http://access.xps350.com
 
C

Clifford Bass via AccessMonster.com

Hi,

Try this in the criteria line:

Like "6[A-Z]?"

Clifford Bass
 
C

Clifford Bass via AccessMonster.com

Hi,

That assumed the third was always a letter or number. If it can be
something else try:

Like "6[A-Z][A-Z,0-9]"

Clifford Bass

Clifford said:
Hi,

Try this in the criteria line:

Like "6[A-Z]?"

Clifford Bass
 
K

KARL DEWEY

Try this --
SELECT YourTable.*
FROM YourTable
WHERE Left([product_code],1) = "6" AND (Mid([product_code],2,1) Between "A"
AND "Z") AND Mid([product_code],3,1) Between "0" AND"9" AND
Mid([product_code],3,1) Between "A" AND "Z"
ORDER BY [product_code];
 
G

Grd

This is excellent. Very efficient.

Tx

Clifford Bass via AccessMonster.com said:
Hi,

That assumed the third was always a letter or number. If it can be
something else try:

Like "6[A-Z][A-Z,0-9]"

Clifford Bass

Clifford said:
Hi,

Try this in the criteria line:

Like "6[A-Z]?"

Clifford Bass
 

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