Results 1 to 5 of 5
  1. #1
    andy-29 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Culver City
    Posts
    34

    Post Auto increment Letter

    I have an ID field that I would like to start with the letter A and increments by 1.


    A, B, C....Z then next AA, AB, AC....AZ all the way to ZZ.

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Probably not easy. First query the table to find the max value then convert the ASCII characters to decimal, increment, then convert back to alpha.

    ASC("A") = 65
    ASC("B") = 66
    ASC("a") = 97

    Chr(97) = "a"

    However:
    ASC("AA") = 65
    ASC("AB") = 65

    Get it? Parse the string and get decimal value of each part, increment value(s) and concatenate back to alpha:

    Chr(65) & Chr(67) = "AC"

    Why do you want this?
    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.

  3. #3
    andy-29 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Culver City
    Posts
    34
    Forgot to mention that I'm new at this. Don't know VBA.
    Just got curious if there was a simple way to not use the autonumber, rather to create a custom ID field.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    No, it is not simple. Custom unique ID is common topic. Search forum and Google.
    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.

  5. #5
    andy-29 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Culver City
    Posts
    34
    Ok, thanks!

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

Similar Threads

  1. Auto-Increment feature
    By Philosophaie in forum Forms
    Replies: 1
    Last Post: 08-19-2012, 10:37 PM
  2. Auto Increment Textbox
    By alyon in forum Access
    Replies: 3
    Last Post: 07-15-2011, 06:38 AM
  3. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  4. Auto Increment by 1 Letter
    By Cinquefoil22 in forum Database Design
    Replies: 4
    Last Post: 07-02-2010, 10:35 AM
  5. Replies: 2
    Last Post: 12-08-2009, 01:19 PM

Tags for this Thread

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