p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   A query to extract part of a string (http://p2p.wrox.com/showthread.php?t=10303)

RayL March 9th, 2004 03:24 PM

A query to extract part of a string
I am trying to build a query to look through a list for entries that end with a number enclosed in parentheses. Any suggestions?

SerranoG March 9th, 2004 05:36 PM

In your query's criteria section for that field, enter this as the criteria:

Like "*(?)"
Like "*(??)"

The first one gives you any one-digit number. The second gives you any two-digit number, etc. Remember to include the word LIKE in your criteria. It's a key word.

The * wildcard signifies that anything can be before the (.
The ? wildcard(s) signifies that one (two, etc.) characters can be inside the ().

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

Braxis March 10th, 2004 05:08 AM

If there's a possibility that the brackets at the end of the string may contain letters, you can make the pattern even more exact by using the following:

Like "*([0-9])"
Like "*([0-9][0-9])"

Where [0-9] means ensure that the character in this position is between 0 and 9.

Brian Skelton
Braxis Computer Services Ltd.

RayL March 10th, 2004 09:42 AM

Greg, Brian .... thanks guys, it worked great. I also needed to get a field that contained only the four digit number, but I worked that out myself. Thanks again... Ray

All times are GMT -4. The time now is 10:02 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.