Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit Field Entry to Letters and Numbers Only? 3

Status
Not open for further replies.

frosty2000

Technical User
Feb 5, 2005
18
US
Hello,

I have a field in my form titled "Address" and I want to limit the entry to only letters and numbers (i.e. no punctuation - no periods, commas, etc).

I've done some research on both input masks and validation tests, but I can't quite figure out which one is best or exactly how to limit it to letters and numbers only.

Any ideas?
Thanks,
frosty2000
 
Have you played with Input masks (at the table level and the form level)? If this does not work, you can use the BeforeUpdate event procedure to clean the data. String functions to look at within Access help include...
InStr
Left
Right
Mid
Replace


Richard
 
Richard,

Thanks for your help. I was able to set up my own customized Input Mask. Here are the details:

Description: No Punctuation
Input Mask: a
Placeholder:"
Mask Type: Text/Unbound
Select "Without Symbols in Mask"

Note: The input mask "a" limits entry to a letter or number only.

I tested this in Form View, and it appears to be working OK. Thanks for your help!
 
Another way, in the BeforeUpdate event procedure of the TextBox:
Cancel = (Me![textbox name] Like "*[!0-9A-Z]*")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV -- What an absolutely great way of using a True/False test!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top