Finding alphabetic only in a text field

  • Thread starter Thread starter Guest
  • Start date Start date
I have a text field. How can I find records with only alphabetic characters
in it?
Thanks

A Query with a criterion

NOT LIKE "*![A-Z]*"

should work.- the LIKE "*![A-Z]*" will find all records containing any
nonalphabetic character (including blanks), and the NOT will show you
the rest.

John W. Vinson[MVP]
 
Thank you both.

This T2 field could be eg 'SK'. The criterion worked (found error) for :
'S%' and 'S3' but not for 'S '. Thoughts?

Thanks.

Marshall Barton said:
Doug said:
I have a text field. How can I find records with only alphabetic characters
in it?


Note that the ! should be after the [
 
I used: Like "*[!A-Z]*"



Doug F. said:
Thank you both.

This T2 field could be eg 'SK'. The criterion worked (found error) for :
'S%' and 'S3' but not for 'S '. Thoughts?

Thanks.

Marshall Barton said:
Doug said:
I have a text field. How can I find records with only alphabetic characters
in it?


Note that the ! should be after the [
 
Thank you both.

This T2 field could be eg 'SK'. The criterion worked (found error) for :
'S%' and 'S3' but not for 'S '. Thoughts?

The character " " is a nonalphabetic character. It's working correctly
based on what you asked for (which, of course, may not be what you
*wanted*...


John W. Vinson[MVP]
 
I might have:

'SK' which is valid data, both alpha
'S%' % not alpha
'S3' 3 not alpha
'S ' space not alpha

I want my query to bring back 'S%', 'S3' and 'S '.
 
I might have:

'SK' which is valid data, both alpha
'S%' % not alpha
'S3' 3 not alpha
'S ' space not alpha

I want my query to bring back 'S%', 'S3' and 'S '.

Actually Access truncates trailing spaces. Does the field in fact
contain "S " - or just "S"? You can check by using the Len()
function...

John W. Vinson[MVP]
 
The Len is 1, so the field has only "S", even if I enter S and a space. The
truncation of trailing spaces *is* important. Thanks for the noodling.
 
The Len is 1, so the field has only "S", even if I enter S and a space. The
truncation of trailing spaces *is* important. Thanks for the noodling.

I believe you can use a DDL query to create an Access fixed-length
Char field (the default is the equivalent of a SQL Varchar). Don't
remember the exact syntax though - something like

ALTER TABLE mytable
(fieldname CHAR(2));

John W. Vinson[MVP]
 
Back
Top