query in text field

  • Thread starter Thread starter Vishal Sewkaransing
  • Start date Start date
V

Vishal Sewkaransing

Hi there
I have a text field with all different text like
A1000
A1
A 1000
A 10

what i want to do is filter only the fields with A1000 ( letter + numbers )
there are 1 to 4 numbers behind the letter
how do i achieve this?
any help is greatly appreciated
Thanks

--
V. Sewkaransing
www.SuriStar.com online support via (e-mail address removed)
www.SuriSMS.com online support via (e-mail address removed)
www.MobielPlezier.com

MOBILE , SMS & ICT Solutions

Dr. J.F. Nassylaan # 35 Boven
Office Hours 9.00 AM - 6.00 PM
Telefoon : +597-420094 / Mobiel : +597-8515544
Messenger : (e-mail address removed)
 
You would need to set some criteria on your record source.

Where YourFieldName Like "[a-z]#*"

Hope that helps!
 
Jeff said:
what i want to do is filter only the fields with A1000 ( letter + numbers )
there are 1 to 4 numbers behind the letter

You would need to set some criteria on your record source.

Where YourFieldName Like "[a-z]#*"

? CBool(CurrentDb.OpenRecordset("SELECT 'A1234' LIKE
'[a-z]#*'").Fields(0))
True
? CBool(CurrentProject.Connection.Execute("SELECT 'A1234' LIKE
'[a-z]#*'").Fields(0))
False

Oops! Doesn't work in ADO.

? CBool(CurrentProject.Connection.Execute("SELECT 'A1234' LIKE
'[A-Z][0-9][0-9][0-9][0-9]'").Fields(0))
True
? CBool(CurrentDb.OpenRecordset("SELECT 'A1234' LIKE
'[A-Z][0-9][0-9][0-9][0-9]'").Fields(0))
True

Works for both DAO and ADO.

Jamie.

--
 
Since you sample data has A, Space, Numbers, I am assuming that you want to
screen out the fields with spaces.

Like "[A-Z]*" AND Not Like "?*[!0-9]*"

Starts with a letter and doesn't have any characters other than 0 to 9 in
the rest of the string
 
Back
Top