Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Nov 2001
    Location
    Burbank, Illinois, USA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Student ID (Access 2000)

    I would like to automatically generate a student id number for all students. Here is the setup I would like generated: first two digits would be a 2 digit school number, next two digits would be a 2 digit graduation number and the last 5 digits would be an automatic number generator starting with 00001. Here is an example of what I mean.

    Student A attends School B which is number 01
    Student A graduates in the year 2005

    I would like to automatically generate a number which would end up looking like this:
    010500001

    Can this be done?

    Thanks in advance for all your help!

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Student ID (Access 2000)

    It can be done. However, you might want to think twice about doing it. Such numbers often cause problems. What happens if student switches schools? What happens if student doesn't graduate when expected? If you do want to use it, however, the place to put your code is in your form's Before update event, after everything else has been checked. Made the ID a string, then just concatenate all the values together.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Nov 2001
    Location
    Burbank, Illinois, USA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Student ID (Access 2000)

    Thanks for the help. I hate to sound like an idiot, but how would I do that?

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Student ID (Access 2000)

    I would add an autonumber to your Student record (call this field something like StudentSystemID), and make that the primary key. The StudentID that you will be forming should be declared as "Indexed, No Duplicates". The VBA code for forming this StudentID will be something like this:

    StudentID = format(SchooID,"00") & format(right(GradYear,2),"00") & format(StudentSystemID,"00000")
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •