Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12

    New Record number (not AutoNumber) upon new record creation

    I have been pouring through this, and other forums looking for the answer to this question. So far I have not been able to find it. I am not a beginner, nor am I an expert...I am part of that dangerous middle group that tries to do things just beyond their experience level, and goes bald in the process from pulling their hair out when it doesn't work.



    I have a personnel tracking database that now needs two "AutoNumber" fields. The REAL AutoNumber is set at PersonID in the "Master" table I need a second field (UnitID) to auto generate a number when a new record is created. My thought was to use the AutoNumber in PersonID and then add 1 or 2 or 10... to it. I have tried everything that I can think of to get it to work...but so far no love. Any help would be greatly appreciated.

  2. #2
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    There are a number of ways to do this. However let me first ask whether this is a multi-user application where more than one person may be using the db simultaneously.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  4. #4
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    RuralGuy, thank you for the rapid reply. Maybe I am entering this string in the wrong location. I am entering it in the Master table, in the UnitID field under the Default Value. When I do that I get "Unknown function 'Nz' in validation expression or default value on 'Master.UnitID'". This is what I have been getting everytime I have tried a Nz or DMax expression.

  5. #5
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    Rod, this (for now) is a single user application. In the next 6 months to a year it may become a multi-user environment.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by lmjje View Post
    RuralGuy, thank you for the rapid reply. Maybe I am entering this string in the wrong location. I am entering it in the Master table, in the UnitID field under the Default Value. When I do that I get "Unknown function 'Nz' in validation expression or default value on 'Master.UnitID'". This is what I have been getting everytime I have tried a Nz or DMax expression.
    Have you checked to see if you have any bogus *MISSING* References?

  7. #7
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    AAAhhhh...and this is where my knowledge fails. So far everything that I have done to include VB and SQL coding has worked properly and so I have not had to mess with references yet. I am afraid that I do not know how to check that. I will have to figure out how to check that.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  9. #9
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    Very helpful...thank you. I was out looking for the directories on my C: drive. Yes, based on the tutorial all of my references are present and accounted for.

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I have a personnel tracking database that now needs two "AutoNumber" fields. The REAL AutoNumber is set at PersonID in the "Master" table I need a second field (UnitID) to auto generate a number when a new record is created. My thought was to use the AutoNumber in PersonID and then add 1 or 2 or 10... to it. I have tried everything that I can think of to get it to work...but so far no love. Any help would be greatly appreciated.
    What exactly is the new number for? Please describe, perhaps with an example.
    Maybe you could describe in plain English - no autonumbers etc - WHAT you are trying to do. Maybe there are options for solution.

  11. #11
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    I am trying to generate a number automatically in sequential order to the highest previous number to fill in a employee ID field. it cannot be the AutoNumber in the Master table...it must be its own self generated number that is created as soon as the Add New Employee form is opened up.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    NewNumber = DMax(YourEmployeeId) + 1

    Why do the numbers have to be sequential? And can't be autonumber? Just curious.

    You didn't really address my question in non Access - plain English.

    Maybe you could describe in plain English - no autonumbers etc - WHAT you are trying to do. Maybe there are options for solution.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do know that an AutoNumber is not guaranteed to be contiguous, right?

  14. #14
    lmjje is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    12
    yes...that is why I do not want to use it...using that number to generate a new number was just one way that I tried to get a number to auto generate. I have a work around that is working for now, but I would prefer to have an actual solution and not a work around.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As Rod had asked earlier, being MultiUser may bite you later on with your solution.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Replies: 1
    Last Post: 02-02-2012, 08:34 PM
  3. Creation of autonumber on open form
    By Pragmatic in forum Forms
    Replies: 1
    Last Post: 12-17-2011, 11:39 PM
  4. Creation of New Record when Tab Last Field
    By Lupson2011 in forum Access
    Replies: 2
    Last Post: 09-07-2011, 08:05 AM
  5. Replies: 9
    Last Post: 06-20-2011, 03:42 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