Results 1 to 5 of 5
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    Custom Autonumber prefix drops off within table.

    I am trying to add a prefix to the autonumber in a table so when I append it to a different table I can ensure the values are unique and won't get bounced. The table I am appending to already has an autonumber and some of the ids in the 2 tables are the same.

    I created an autonumber field with the format "777"0000
    When I look in the table I see the id is set to 7771111 but if I click on that field the 777 disappears and when I append this data to the other table it drops off as well.

    Is there a way to make this prefix stick as part of the autonumber. I tried copying the field to another field but it also only copies the 1111 and not the full 7771111 number.



    Hope I am making sense

    Thanks in advance

    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	17.1 KB 
ID:	29606

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You have no control over determining that Autonumber value.
    What you are actually doing with the "777" is just applying a Custom Format to the field. It does not change the actual value of the field. The value is stored without the "777" (it isn't really there, it is just a custom format).

    You would have to change the field from an Autonumber to something else if you want control over settings its values.

    Perhaps create a new primary ID field for the table that has a prefix and then your Autonumber added to it. I guess it really depends on why you are trying to do this, and what it is actually used for, other than a unique identifier (are there other things linked to it)?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Format property setting does not change data, it is merely a display setting.

    Cannot modify autonumber value and save back into the autonumber field.

    Why should it matter if autonumber fields in different tables generate same numbers?

    Autonumber keys are not supposed to have meaning to users.

    Why do you show 777 in narrative but 770 in table?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    mindbender,
    I am trying to add a prefix to the autonumber in a table so when I append it to a different table I can ensure the values are unique and won't get bounced. The table I am appending to already has an autonumber and some of the ids in the 2 tables are the same.
    ??
    Perhaps I'm missing you point.
    It seems you have 2 tables. Each table represents a separate concept/thing/entity. I don't follow how the same value for the autonumber PK in each table is an issue???

    Eg, John Doe is 47 years old. He lives at 47 Apple Street. His zip code is 47000. The 47 is not an issue.

    Consider, you Sell 300 units of a product whose ProductID is 300 to Customer number 300.

    Please tell us more about the id values being the same is 2 separate tables.

  5. #5
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    Quote Originally Posted by JoeM View Post
    You have no control over determining that Autonumber value.
    What you are actually doing with the "777" is just applying a Custom Format to the field. It does not change the actual value of the field. The value is stored without the "777" (it isn't really there, it is just a custom format).

    You would have to change the field from an Autonumber to something else if you want control over settings its values.

    Perhaps create a new primary ID field for the table that has a prefix and then your Autonumber added to it. I guess it really depends on why you are trying to do this, and what it is actually used for, other than a unique identifier (are there other things linked to it)?
    Thanks for the clarification. I will go a different route

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

Similar Threads

  1. Prefix autonumber based on combo
    By gint32 in forum Forms
    Replies: 11
    Last Post: 05-10-2017, 09:06 AM
  2. Custom Sequential autonumber of different series
    By binitbegwani in forum Forms
    Replies: 3
    Last Post: 08-18-2015, 05:56 PM
  3. Custom Autonumber based on lookup
    By npresadbukka in forum Access
    Replies: 2
    Last Post: 07-08-2013, 10:36 PM
  4. How to make a custom autonumber?
    By AccessThis in forum Access
    Replies: 1
    Last Post: 07-20-2010, 06:49 PM
  5. Add prefix to AutoNumber
    By sirmilt in forum Database Design
    Replies: 3
    Last Post: 07-09-2010, 01: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