Results 1 to 3 of 3
  1. #1
    jdlantz is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2014
    Posts
    7

    Display Max Ref No if preceded by F / J (can I "max if")


    I need something like a "max if", that is, to return the max value if the number is preceded with a specific letter.

    Our reference number system is a 5 character system: 1 letter + 4 numbers. The letter indicates the type of document being referenced, and the numbers start at 1 and count up within each letter range. (So it is acceptable to have both F0001 and J0001.) We want to use only one reference field although we may have many letter codes. On the data entry form, however, I want to display the next available number for certain letter codes. Here I am using "F" and "J" so my reference field might have these entries:

    F0077
    J0046
    F0078
    J0047
    F0079

    And I would want my form to have two boxes displaying F0080 and J0048.

    If it helps, I had a similar Excel spreadsheet and got some help from another forum to build an array formula below:
    {="F"&TEXT(MAX(--RIGHT(L$7,4),IFERROR(--SUBSTITUTE(UPPER($K$13:$K$3002),"F",""),0))+1,"000 0")}

    At the moment I'm trying to use some sort of combination of IIF() and DMax() with Left() and/or Right(), but I'm not getting it.

    Any help is appreciated!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Generating custom unique identifier is common topic. Search forum.

    Try:

    "F" & Format(Mid(Nz(DMax("fieldname", "tablename", "Left([fieldname],1)='F'"),"F0"),2) + 1, "0000")

    "J" & Format(Mid(Nz(DMax("fieldname", "tablename", "Left([fieldname],1)='J'"),"J0"),2) + 1, "0000")
    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
    jdlantz is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2014
    Posts
    7
    Thank you very much, it worked!

    I apparently wasn't using the right search terms but I will check out more about unique identifiers.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  2. Replies: 14
    Last Post: 08-23-2014, 12:35 PM
  3. Ways to display a "Live" job list
    By stildawn in forum Access
    Replies: 10
    Last Post: 10-19-2013, 03:47 PM
  4. Replies: 5
    Last Post: 10-18-2013, 05:03 PM
  5. Replies: 5
    Last Post: 08-10-2010, 02:57 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