Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

query to find numbers and not alphanumeric

access 2010:

I need a query that will only find me records that have a numeric pattern in then.

I need to find these:
Item
10000010
10000072
10000100
10000110
10000251
10000252
10000259
99999333
etc...



and not alphanumeric  combinations
Item
1CFJ4
1CFJ5
2ccc45
3wwe2

etc...

I was trying this but not working.

SELECT OneToOneMatches_2013.Item, OneToOneMatches_2013.del
FROM OneToOneMatches_2013
WHERE (((OneToOneMatches_2013.Item) Like '%[^a-zA-Z0-9]%'));

Thanks
fordraiders
ASKER CERTIFIED SOLUTION
Avatar of Jeff Darling
Jeff Darling
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try

SELECT OneToOneMatches_2013.Item, OneToOneMatches_2013.del
 FROM OneToOneMatches_2013
 WHERE IsNumeric(OneToOneMatches_2013.Item) = True
you can use the IsNumeric() function.  Just be aware that decimal points are considered numeric for this purpose and d, e, and -, can make Access think the field is scientific notation which would be considered numeric.

The safest method is to write your own function that loops through each character and only if each individual character is numeric, is the whole field numeric.

I'm not sure what you are trying to do with the Where clause.  The * is the wildcard you probably want to use in Access.  You also only want the digits 0-9.  You don't want the others.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fordraiders

ASKER

worked great..Thanks