Input Mask - codes to create custom listed (1 Viewer)

Rx_

Nothing In Moderation
Local time
Today, 03:08
Joined
Oct 22, 2009
Messages
2,803
Was looking for the code for optional, posted the codes below as a future reference for others.

Trying to put an input mask that allows for an optional two last digits.
AA\-AAA\-AAAAA\ aa
Tried AA\-AAA\-AAAAA\-aa
But the last dash stays example 11-222-22222- or 11-222-22222-33 the "\" prints what ever literal follows it, in this case a dash.

Any suggestions on how to allow for a number, with an optional 2 digits but with out a traling dash?

Some more example can be found here:
http://msdn.microsoft.com/en-us/library/aa196136(office.11).aspx
But, an optional "-" followed by optional numbers is not covered.
so, my "-" is just hanging out there.

Code:
[B]The following characters define an Input Mask:[/B]
[B]Character - Description [/B]
[INDENT]0 - Digit (0 to 9, entry required, plus [+] and minus [–] signs not allowed). 
[/INDENT][INDENT]9 - Digit or space (entry not required, plus and minus signs not allowed). 
[/INDENT][INDENT]# - Digit or space (entry not required; spaces are displayed as blanks while in Edit mode, but blanks are removed when data is saved; plus and minus signs allowed). 
[/INDENT][INDENT]L - Letter (A to Z, entry [U]required[/U]). 
? - Letter (A to Z, entry [U]optional[/U]). 
A - Letter or digit (entry [U]required[/U]). 
a - Letter or digit (entry [U]optional[/U]). 
& - Any character or a space (entry [U]required[/U]). 
C - Any character or a space (entry [U]optional[/U]). 
[/INDENT]. , : ; - / Decimal placeholder and thousand, date, and time separators. (The actual character used depends on the settings in the Regional Settings Properties dialog box in Windows Control Panel). 
 
< - Causes all characters to be converted to lowercase. 
> - Causes all characters to be converted to uppercase.  i.e UCase()
 
! - Causes the input mask to display from right to left, rather than from left to right. Characters typed into the mask always fill it from left to right. You can include the exclamation point anywhere in the input mask. 
 
\ - Causes the character that follows to be displayed as the literal character (for example, \A is displayed as just A). 
 
[B][U]Examples[/U]:[/B] 
[INDENT]LLLLLL - 6 Letters [A-Z] are 'required'
AAAAAA - 6 Letters or Digits are 'required'
[/INDENT][B]NOTE:[/B] Select the Input Mask Field for a Field in Table Design View on the bottom Pane and press F1
 
Last edited:

the_net_2.0

Banned
Local time
Today, 04:08
Joined
Sep 6, 2010
Messages
812
if you look up "masks" in the help files, it will give you the instructions on what mask characters do and what their purposes are.

additionally, a zero (0) indicates a required numeric, and a nine (9) indicates an optional numeric.

hth
 

Rx_

Nothing In Moderation
Local time
Today, 03:08
Joined
Oct 22, 2009
Messages
2,803
It is the same issue for US Zip codes - leaving the hanging dash:
For US Zip codes there is an old 5 digit or the ZIP+4 (73766 or 73766-2002)
After searching for a while found that the digit will return 73766-
And leave the hanging dash.



So far, the only solutions found are along the line of the following:
Make the mask 000009999
On the AfterUpdate event of ZipCode place this code
If Len(ZipCode) >5 Then
ZipCode = Left(ZipCode,5) & "-" & Right(ZipCode,4)
End If
 

Users who are viewing this thread

Top Bottom