Results 1 to 5 of 5
  1. #1
    jabrjo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    33

    Find/Display Next Available Number

    I am fairly new to Access so I apologize if my questions or responses are a little confusing.



    Anyway - I am creating a form for users to enter data. Each entry needs to have a "Event ID" associated with it and these Event IDs may be used more than once but will refer to the same Event (if it was a single entry with no duplicates, I would just use the rows primary key). Does anyone know how to create a query that looks at a list of existing numbers (Events already in the table) and returns the next/an unused number? I would like to create a button that says "Next available Event ID" and provides the user with a number.

    Thank you for your help!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    On the form, calc the next id:

    txtEventID = Dmax("[EventID]","tMyTable") + 1

  3. #3
    jabrjo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    33
    Thanks, Ranman. Where do I enter this calculation? Do I create a query or can I calculate this via a button?

  4. #4
    jabrjo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    33
    Ranman, I built the expression in a query and will create a button to display the number. Thanks!

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Query is not needed. Domain aggregate functions can be used in VBA or in textbox ControlSource and DefaultValue properties.
    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.

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

Similar Threads

  1. Find Max number
    By NISMOJim in forum Programming
    Replies: 11
    Last Post: 05-17-2013, 03:01 AM
  2. Find First number in sequence of numbers
    By losstww in forum Queries
    Replies: 4
    Last Post: 11-16-2012, 02:44 PM
  3. Replies: 3
    Last Post: 08-13-2012, 08:04 AM
  4. Find employee, display name, calculate retirement
    By sephiroth2906 in forum Forms
    Replies: 2
    Last Post: 10-24-2011, 02:59 PM
  5. Replies: 6
    Last Post: 07-25-2011, 01:54 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