Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Appleton, Wisconsin, USA
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    limiting number of records a user can enter (2000 SR-1)

    I'm trying to create a class registration database. Certain classes only allow a certain number of registrations due to training room size. I have a classes table and an employee table: how do I restrict the number of employee records that can be associated with each class? The class size varies based on training location. Thanks!

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Angela,

    In the Before Insert event of the form, check the number of employees associated with the active class and if the maximum is reached, open a message box to say the class is full and cancel the insert of the record.

    An other way to solve this can be to check if the class is full when you activate the class and set the Allow additions of the form to False.
    Francois

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Appleton, Wisconsin, USA
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Francois,
    I understand the concept, but do not know coding well enough to know what to type, where. Do I need a macro for this? A module? Or can I set up an Event Procedure? Any further help is GREATLY appreciated.
    Thanks,
    Angela

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Let's try to be a little more specific and explain how I would solution this problem.

    I would make a form form the class with a subform listing the employees that have registered for the class.
    In the On Current event of the form i would code the following:
    1.Counting the number of registered employees that class.
    2.Compare it to the maximum of that class.
    3.If the maximum is reached, make visible a control on the form saying the class is full, and set the Allow Addition of the subform to false.
    4.If the maximum is not reached, make the same control invisible, and set the Allow Addition of the subform to True.

    This require some coding and if you are not familiar with coding, I can try to make a little mdb with a sample of what I explain, but it will take some time to write it. Let me know if you want I do this.
    Francois

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Appleton, Wisconsin, USA
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    If you could give me an example of the coding, I would appreciate it very much. I don't know if this helps, but I'm attaching an image of the query I've set up that shows the Count of Students. It also shows the database relationships if that helps at all.
    Thanks!
    Attached Images Attached Images

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Angela,

    In the attached mdb a sample of what you can do.
    There is code in the On Current event of frmClass and in the After Insert and After Delete Confirm events of frmNamesAndClass

    Success.
    Attached Files Attached Files
    Francois

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Appleton, Wisconsin, USA
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    It worked beautifully!! Thank you so much.

    May I ask how you created that code? I would like to get to that point and I'm wondering if there are tools I can use to create it, if I should take a class, or what the best approach would be.

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Glad that it helps you.
    I never take classes. I find them too expensive, at least in our country, maybe in the US you have better prices.
    I learn it all on the fly. Many hours (ask my wife and daughters) at my PC, reading books, magazines, code from others, usersgroups (like this one),...
    The only tool I heavily use is <A target="_blank" HREF=http://www.fmsinc.com/products/analyzer/index.html>Total Access Analyzer</A> but this is only a tool to detect errors in access applications and to produce documentation about the application.
    Francois

  9. #9
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Appleton, Wisconsin, USA
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting number of records a user can enter (2000 SR-1)

    Well, thank you once again! You've certainly saved me hours and hours!

Posting Permissions

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