Results 1 to 6 of 6
  1. #1
    Koolaid is offline Novice
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Location
    Northern VA
    Posts
    26

    Question Auto populate half of a serial number in a form field automatically

    I would love to learn how to auto populate half of a serial number in a form field automatically so I do not have to type the beginning 8 numbers that are always the same anyway as part of a long 20 number serial. I am assuming the default value can be made to do this BUT I have no idea which function it is within Access or how to properly type it correctly.

    Thanks from this noob in advance


    Koolaid

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    There is more than 1 way to skin this cat. Part of the answer depends on your data structure and when this is to occur.

    For instance you could set the table's field property, or the form's text property to have a default value of those first 8 characters - so that at least this much is there to begin with. Or you could write some VBA to insert those 8 characters upon tabbing into the field or tabbing out of the field....

  3. #3
    Koolaid is offline Novice
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Location
    Northern VA
    Posts
    26
    And what would the command be to input something like this? I'm trying to use the least amount of VBA as possible since I barely know Access let alone VBA lol Thanks!

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Also note, if the first 8 characters never change you can avoid entering them altogether and rely on the INPUT MASK, your data would only be stored with the last X characters but be displayed with all of them.

    For instance if you had an input mask of:

    "SN123456"&\ 000000

    Every time you went to type in a new serial number it would automatically be populated with the first 8 characters SN123456 and require 6 following digits, or you could just forget the input mask and only enter the last X digits then when you need to print a bar code, or a label concantenate the first 8 static characters with the contents of the field

    SerialNumber = "SN123456" & [SNSuffix]

  5. #5
    Koolaid is offline Novice
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Location
    Northern VA
    Posts
    26
    Awesome!! It just so happens I was messing with the mask option before reading this. I'll give the options a try. Appreciate it

  6. #6
    Koolaid is offline Novice
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Location
    Northern VA
    Posts
    26
    Quote Originally Posted by rpeare View Post
    Also note, if the first 8 characters never change you can avoid entering them altogether and rely on the INPUT MASK, your data would only be stored with the last X characters but be displayed with all of them.

    For instance if you had an input mask of:

    "SN123456"&\ 000000

    Every time you went to type in a new serial number it would automatically be populated with the first 8 characters SN123456 and require 6 following digits, or you could just forget the input mask and only enter the last X digits then when you need to print a bar code, or a label concantenate the first 8 static characters with the contents of the field

    SerialNumber = "SN123456" & [SNSuffix]
    Btw, you're awesome! I went ahead with the mask input option and it also helped me with the next part, which was to only have to search in a query for the last 12 numbers. It auto finds the whole string based on just inputting the last 12 numbers out of the 20. Appreciate it again!
    Last edited by Koolaid; 03-15-2016 at 11:50 AM. Reason: mispelled word

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

Similar Threads

  1. Replies: 9
    Last Post: 08-15-2014, 12:03 PM
  2. Replies: 6
    Last Post: 02-10-2014, 01:04 PM
  3. Replies: 1
    Last Post: 10-25-2013, 03:38 PM
  4. Replies: 1
    Last Post: 10-16-2013, 09:41 AM
  5. Auto Sequence String Serial Number
    By eddyc99 in forum Programming
    Replies: 2
    Last Post: 10-02-2009, 08:11 AM

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