Microsoft Access databases provide a wealth of tools and utilities to help control design layouts and data integrity. Working with the latter, you can reduce and even dismiss any programming at all to control data entry to a field in a table or via a form using the Access Input Mask feature.
Take a quick look at this useful Microsoft Access tutorial (using version 2010) on how to set up an input mask.
Very easy to create indeed and the video covers the pre-set options which to be honest is based on the US style conventions for storing telephone numbers and zip codes!
Microsoft Access Tutorial: How to use Input Masks
From one of my earlier posts, I’ve already mentioned about the key to knowing the input mask feature is to understand the code that sits behind this tool.
This is particularly more important to know and master if you are going to not just build custom code solutions but clearly for the non US based systems, makes it more relevant.
So you can now avoid and forget zip codes and build your own post code or scrap social security numbers for national insurance numbers.
The easiest way to start is to use the input mask wizard tool for the selected field in the properties section of the design view for a table (or form) and then you can modify the code it generates or even build expressions via the wizard tool.
Remember to save changes should you need to add more than one field’s properties (other way, you will be prompted to in any case) and that we are only talking about text and date/time data type fields as numeric values do not apply.
As I’ve already said, the default input masks options does not always meet your needs and you may need to edit them. In the wizard, simply click the Edit List button provided on the first screen of the Input Mask Wizard and start editing.
Here are the valid characters that you may include in an input mask:
0: User must enter a numeric digit (0 through 9)
9: User may enter a numeric digit (0 through 9)
#: User may enter a numeric digit, space, +, or –
L: User must enter a letter
?: User may enter a letter
A: User must enter a letter or numeric digit
a: User may enter a letter or numeric digit
&: User must enter a character or a space
C: User may enter characters or spaces
In the list above, note the use of the words; “must” and “may“. Some Microsoft Access database input mask characters are optional, allowing the user to enter data in a field but also allowing them to leave it blank.
The characters “.“ “,” “:” “;” “–” and “/” may be included as placeholders and separators where required. In addition to these, you may also include some special directives in your input masks which can include:
!: Input provided by the user is entered from left to right instead of the normal right to left format.
>: All characters after this symbol are converted to uppercase regardless of how the user inputs them.
<: All characters after this symbol are converted to lowercase regardless of how the user inputs them.
\: The character immediately following the slash will be displayed in the mask as written.
“”: Characters included in quotation marks will be displayed in the mask as written.
Need to learn more about Microsoft Access? Check out my eBook bundle offer.