Results 1 to 5 of 5
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Limiting the number of entires to a table (A2k Sr1)

    TABLE1 contains six fields,
    ID, LastName, FirstName, Session, Career, Counter

    ID is the autocounter
    LastName is text
    FirstName is text
    Session is an integer
    Career is text
    Counter is an integer

    Form1 is linked to Table1 for data input purposes. LastName, FirstName, Session, and Career are set up as the Primary Key.

    What code could be used or validation rule to limit the number of unique values of Session and Career to 20. For example, when inputting data, the maximum number of Doctors in Session 1 can not exceed 20?

    Thanks for the help.
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Limiting the number of entires to a table (A2k Sr1)

    Well, a Dcount on Session and Career should give you the current count. If you do that before you allow the selection to be completed, you can test for the count >=20 and handle accordingly.
    Charlotte

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Limiting the number of entires to a table (A2k Sr1)

    Thanks again. I was already heading down this path.
    Regards,

    Gary
    (It's been a while!)

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Limiting the number of entires to a table (A2k Sr1)

    I have tried the Dcount on Sessions and Careers and can't get it to work properly. (That is, the function returns the wrong number) Any suggestions.
    Regards,

    Gary
    (It's been a while!)

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Limiting the number of entires to a table (A2k Sr1)

    Try DCount("[ID]","Table1","[Session]=" & varSession & " AND [Career]=" & varCareer)

    This assumes you're doing this from code and have stored the session identified and career indentifier in variables. If either of the fields is a text field, you'll need to insert quotes as text delimiters. If this doesn't help, post the DCount formula you tried so someone can help tweak it.
    Charlotte

Posting Permissions

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