
Originally Posted by
bakkouz
Hiya,
I have a question regarding input masks, I'm currently used an input mask on a control on my form to store the value in the form of ( DL00-0000 ) eg: DL10-1874 or DL11-2547
-The DL part is constant, ie: always = DL
-The two numbers following DL can only be digits from 1 to 9, ie : 11 or 88 or 63
-The Minus sign is constant, ie: always = (-) (a representation of divider obviously not a mathematical minus)
-And Finally, the last four digits can only be digits from 1 to 9, ie: 6587 or 1265
At first I used this form of input mask: "DL"00"-"0000
but this only stored the numbers entered into a form without the DL or the Minus sign, eg: 555555
So then I used this form of input Mask: LL00\-0000 and set the default value of the control to "DL00-0000" this managed to store the DL but not the Minus sign, eg: DL555555
I'm currently stumped. I don't know what to do, should I use both Input mask and default value, or can an input mask alone do the trick, and if so, how should it look like?
To sum up: I need the user to enter 6 digits in the control, ie: (689774), but to be actually stored in the table as: DL68-9774 for example.
Help is much appreciated.
Thank you
Take out the imput mask and Put the following code in the "After Update" event of the field.
Code:
Dim sString as string
sString = Me.YourFieldName
sString = "DL" & left(sString,2) & "-" & Right(sString,4)
Me.YourFieldName = sString