Article ID: 210537 - View products that this article applies to.
This article was previously published under Q210537
This article shows you how to create a sample user-defined function named RemoveAlphas() that removes alpha, or nonnumeric, characters from an alphanumeric string. All nonnumeric characters will be removed.
A common use for the RemoveAlphas() function is to remove the parentheses, dashes, and spaces from a telephone number or a social security number field. For example, the following strings contain parentheses, dashes, and spaces:
"(206) 635-7050"After you run the RemoveAlphas() function, these strings will look as follows:
"2066357050"The following example demonstrates how to create the RemoveAlphas() function, and how to use it, either while someone is entering data, or in an update query to remove nonnumeric characters from phone numbers in a table.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For a field called Phone, add the following code to the AfterUpdate property to the Phone text box on a form:
Article ID: 210537 - Last Review: October 11, 2006 - Revision: 2.2