Results 1 to 2 of 2
  1. #1
    liamfrancis2013 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    7

    Exclamation Only allowing a record to be entered a certain number of times.

    Does anyone know a way to only allow a record to be entered a certain number of times, i need this for a school system where only a certain amount of students can be attending a class e.g a maxinum of 30 in period 1 art. Preferably some simple solution. Thanks



    P.S right now i do have queries that have counted the number of students in a lesson using a iff if that helps

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    when you click the ADD button to add the person, it does a check

    Code:
    sub Add1Person (pvStudentID, pvClassID)
    dim iCount as integer , iLimit as integer
     
     'get the count for current class
    iCount = dcount("[studentID]","tClass","[classID]=" & pvClassID)
    
    'and the limit
    iLimit= dlookup("[Limit]","tClass","[classID]=" & pvClassID)   'whereever you stored your class limits
    
    if iCount+1 <= iLimit then 
        'add the student to class
    endif
    end sub

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

Similar Threads

  1. Counting the number of times a record appears
    By liamfrancis2013 in forum Access
    Replies: 1
    Last Post: 06-08-2015, 07:04 AM
  2. Replies: 7
    Last Post: 12-12-2014, 11:58 AM
  3. Replies: 6
    Last Post: 01-24-2013, 10:02 PM
  4. Replies: 2
    Last Post: 07-16-2012, 10:20 AM
  5. Replies: 14
    Last Post: 02-23-2012, 06:32 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