Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2004, 03:24 PM
Authorized User
 
Join Date: Oct 2003
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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?

 
Old March 9th, 2004, 05:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
 
Old March 10th, 2004, 05:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old March 10th, 2004, 09:42 AM
Authorized User
 
Join Date: Oct 2003
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract part of String carrie09 Access 6 August 24th, 2007 10:04 AM
Extract first numeric string blkskullwork Javascript 1 November 6th, 2006 02:37 AM
how to extract from a string fraijo SQL Server 2000 3 October 25th, 2006 09:55 PM
Getting Part of a String needelp Access VBA 4 September 19th, 2006 06:22 AM
Extract part of field from inconsistent data Roly Reefer Access VBA 4 March 31st, 2005 09:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.