Results 1 to 4 of 4
  1. #1
    clancy76 is offline Novice
    Windows 10 Access 2013
    Join Date
    Oct 2014
    Posts
    25

    Storing data with a custom format


    Hi all, I have a field with a custom format that contains a dash near the end. Essentially it will look like this: 1234567-89 Is there a simple way to accomplish this? The end users tend to type it in without the dash - I know I can use the input mask in the text box but the data wouldn't be STORED with the dash in the table, correct? I need the data to be stored in the table with the dash, 1234567-89. Thanks in advance!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    have an invisible text box (txtBox2) connect to the actual table.
    user enters data in txtBox1 and the afterupdate code corrects it:

    Code:
    if instr(txtBox,"-") = 0 then
      txtBox2 = left(txtBox,7) & "-" & right(txtBox,2)
    else
    
    txtBox2 = txtBox
    endif

  3. #3
    clancy76 is offline Novice
    Windows 10 Access 2013
    Join Date
    Oct 2014
    Posts
    25
    Brilliant, thanks Ranman. Surprised this isn't easier to do on the backend, but your solution will work perfect for me.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    FYI, the second argument of an input mask determines whether the character is stored or not. From:

    https://support.microsoft.com/en-us/...2-4a47832de8da

    The second part is optional and refers to the embedded mask characters and how they are stored within the field. If the second part is set to 0, the characters are stored with the data, and if it is set to 1, the characters are only displayed and not stored. Setting the second part to 1 can save database storage space.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Now Function Custom Format
    By DrJohn in forum Access
    Replies: 9
    Last Post: 03-16-2016, 09:51 AM
  2. Storing Multiple Days of the Week in a Yes/No Format
    By TheMachine in forum Database Design
    Replies: 2
    Last Post: 05-14-2013, 12:46 PM
  3. Custom Currency Format
    By Ichigo in forum Access
    Replies: 3
    Last Post: 04-26-2011, 03:34 AM
  4. Custom Data input mask or format?
    By RiverAnimal in forum Database Design
    Replies: 2
    Last Post: 12-06-2010, 09:58 AM
  5. Custom format for phone#
    By SmokingMan in forum Access
    Replies: 4
    Last Post: 08-02-2010, 10:41 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