Wrox Programmer Forums
|
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 December 28th, 2006, 03:42 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stripping hyphens

Hi everyone,
  I was wondering if there was a good way to have it so that if hyphens are added to a field, they are automatically stripped out. I have a field where people could sometimes use hyphens in it and we want, for consistency sake, to have it without the hyphens. It's a simple text field in which this needs to happen.

Thanks,
Arholly

 
Old December 28th, 2006, 03:53 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You can use a mask and then store the text without hyphens. If this is an SSN or phone number field, the mask will give you the option of storing the text without the hyphens.

Alternatively, you can parse the fields and remove the hyphens, but you would want to run this process off peak. You could also put in business rules that if a hyphen is found Before Insert or Before Update, the user would be warned to remove the hyphens and the record would not be kept.

HTH

mmcdonal
 
Old January 4th, 2007, 09:16 AM
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

I prefer MMcDonal's mask idea best. If you don't use that you can also use something like the REPLACE function in the field's After Update event, e.g. Me.txtField = Replace(Me.txtField, "-", "")


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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stripping Data from a Field jjc9809 Access VBA 1 July 12th, 2008 08:16 PM
Stripping CRLF?? crabjoe Classic ASP Basics 7 February 26th, 2008 05:58 PM
Stripping last X characters fixxer XSLT 2 September 21st, 2007 05:11 PM
regex for stripping space muki XSLT 2 February 8th, 2006 06:29 AM
Stripping down variable values mellan XSLT 1 September 19th, 2005 09:00 AM





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