Results 1 to 9 of 9
  1. #1
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245

    viewing next autonumber


    Hey,

    Is there a way to see what the next autonumbe is in my tabl? thanks,

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Perhaps you could use the DMax() function to return the highest current value and then add one to it. I don't think the result would be very reliable in a multi-user db.
    Not sure why you might want to do this though.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    i am currently doing that right now, you are right it is very unreliable as the next number incremented may not be the next number given by the autonumber. im going to keep using this, but if there is a way to veiw the precise number please let me know, thank you

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Can you tell us why you need to know what the next number will be.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    mike02, you are aware that autonumbers (the autonumber field type) are not guaranteed to be sequential, consecutive or even positive??

  6. #6
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Mike -

    From your posts, I gather you want the autonumber value to have some meaning, as in next document number, or some such. The general consensus is that an autonumber should be used only to ensure a unique ID for each record, and should not be relied upon to be sequential or predictable. If you need to have such a value, you should maintain it yourself (DMax is just the type of function you would use) to ensure predictability. My own opinion is that if you have a field like that and make it the PK of your table, you can do away with the autonumber entirely.

    My 2-cents worth

    John

  7. #7
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    i am aware of the meaning of auto number and that Dmax doensnt work properly as autonumber is not necesarally secuential. this is why i am posting to see if there is a way to see the next number. i just need it to keep unique ids for my tables. I am just curious to see if i can se the next number that is all.

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You do not need to see the "next" autonumber. It will be unique, that is what an autonumber is UNique -not incremental nor positive as others have said.

    see http://www.utteraccess.com/wiki/index.php/Autonumbers

  9. #9
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    I understand that auto number is unique i was just curious to see if there was a function to see what was the next to come, with the uniqueness there is still going to be an algorythem for it to pick the unique number. so i was curious to see if aynone knew what it was.

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

Similar Threads

  1. Viewing a read-only table
    By mejia.j88 in forum Database Design
    Replies: 9
    Last Post: 04-16-2012, 05:31 PM
  2. pictures viewing in access
    By buienxg in forum Access
    Replies: 2
    Last Post: 11-26-2011, 08:44 PM
  3. Data updation & viewing
    By sachin.shelar in forum Forms
    Replies: 1
    Last Post: 10-30-2011, 01:53 AM
  4. Error viewing SQL tables
    By forrestapi in forum SQL Server
    Replies: 6
    Last Post: 10-12-2011, 03:36 PM
  5. Viewing Attachments
    By tcheck in forum Access
    Replies: 3
    Last Post: 08-02-2011, 03:24 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