Results 1 to 6 of 6
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Add 1 to a letter

    Ok kids, I've read a few posts, but haven't found anything to work for my application. This is an ordering system, . The current methodology is Line Item = Reference Number + Alpha character (A, B, C, D) . So I want to do a sequential function, but I need to do it with letters. I was successfully able to retrieve the last letter


    Code:
    getletter: DMax("[jobletter]","jobs")
    and I've tried getletter+1 and of course get a type mismatch error. how do I generate the next letter?

    Thank you in advance as always!
    Gina

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    You can use the Asc() function to get the numeric value, add one to it, then use the Chr() function to get the text value of the result. You'd have to handle rolling over at "Z".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Create a table with two fields letter (a-z) and next letter. (B-a)

    Join the fieldetter and jobletter which gives you instant access to next letter.


    Sent from my iPhone using Tapatalk

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    For ascii, lower case a to z is 97 to 122; upper case is 65 to 90 (decimal). A table would be easier I think, if you had to be concerned about not using the same character twice. In that case, a yes/no field could also be used to flag the letters as having been used. Or are there only 4 letters involved and you're trying to create a list of unique combinations that start using the letter part over and over again when you get to D?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    How many characters long is your field?
    what are your rules for this field (i.e. are caps and lower case to be considered equal or are you is your sequence a - z followed by A - Z)?
    What happens at the roll over? i.e. do you go from a - z, then aa - az followed by ba - bz followed by ca - cz, etc.

    This can be done pretty easily you just have to define your rules. I don't agree that a table would be the easiest way to accomplish this but it's no less valid than any other method.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Perhaps not, after reading your post. I was thinking there would be 26 values max.

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

Similar Threads

  1. Report as Letter
    By blue_echo in forum Reports
    Replies: 1
    Last Post: 04-13-2016, 02:11 PM
  2. Numbers to a letter
    By snipe in forum Queries
    Replies: 3
    Last Post: 04-30-2015, 11:06 AM
  3. Replies: 4
    Last Post: 09-18-2012, 05:07 AM
  4. filter name by letter
    By kbremner in forum Programming
    Replies: 3
    Last Post: 10-30-2010, 07:48 PM
  5. From letter from a report
    By LANCE in forum Reports
    Replies: 4
    Last Post: 07-04-2009, 09:32 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