Results 1 to 2 of 2
  1. #1
    Manass is offline Novice
    Windows 8 Access 2007
    Join Date
    Aug 2013
    Posts
    7

    Limiting size of a field

    Im doing a coursework on ms access on School Management System. I have a table 'tblSubject' containing fields: 'Subject ID' and 'Subject Name' . A student has the right only to choose a maximum of 8 subjects, that is , the field 'Subject ID' must have only 8 records/entries.



    Could anyone help me how to do this ???????

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    This is not limiting size of field but limiting number of records, unless you are using a multi-value field.

    Possibly VBA code in form BeforeUpdate event to check if table already has 8 records for the student. Something like:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If DCount("CourseID", "StudentCourses", "StudentID=" & Me.StudentID) = 8 Then
    Cancel = True
    MsgBox "Eight courses already selected."
    End If
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-20-2013, 04:25 PM
  2. Limiting entry in date field to three dates
    By cmwpcol in forum Access
    Replies: 5
    Last Post: 09-24-2012, 03:49 PM
  3. Limiting list box by another field
    By lukebowes in forum Access
    Replies: 15
    Last Post: 05-21-2012, 12:12 AM
  4. Reduce field size in query field
    By escapades_access in forum Queries
    Replies: 9
    Last Post: 03-13-2011, 12:21 PM
  5. Replies: 4
    Last Post: 07-28-2010, 10:27 AM

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