Results 1 to 3 of 3
  1. #1
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25

    Input Mask Issue

    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

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by bakkouz View Post
    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

  3. #3
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25
    Toyman, you are a genius.
    Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Input Mask/Validation rule
    By SMAlvarez in forum Access
    Replies: 0
    Last Post: 04-11-2011, 07:27 PM
  2. Replies: 4
    Last Post: 10-31-2010, 10:35 AM
  3. Phone Input Mask issue
    By Huddle in forum Forms
    Replies: 4
    Last Post: 08-13-2010, 03:02 PM
  4. day of week input mask
    By jacko311 in forum Programming
    Replies: 7
    Last Post: 11-15-2009, 12:56 PM
  5. Input mask
    By doobybug in forum Access
    Replies: 2
    Last Post: 06-17-2009, 09:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums