Results 1 to 2 of 2
  1. #1
    scotharr is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2018
    Posts
    6

    Event: Action: Create a Table Record when A Different Table Record is Created

    Hi All, (Access Newbie)



    I have two Tables "Class Registration" and "Class Grades" These tables share the fields "StudentID" and "ClassID" When I register a student for the class with a Registration Form, I want to automatically create a Grades record and populate the StudentID & ClassID info into this new record.

    What is the simplest way to do this? Does the event "after insert" equate to the creation of the record?

    Thank you,
    Scott

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    AfterInsert event is available when a new record is created, it does not create record.

    Why create a record before there is grade data? Saving record into Grades can be code:
    CurrentDb.Execute "INSERT INTO [Class Grades](StudentID, ClassID) VALUES(" & Me.StudentID & "," & Me.ClassID & ")"

    The Grades table really should not have StudentID and ClassID. Each record in Registration should have a unique ID, can be autonumber. Grades table should have a field that links to ID field of Registration.

    Each class will have multiple grades (quizzes, tests, final)? If there is only one grade per class registration then why have a separate grades table?

    What if student drops class? Do you delete the registration record? Do you have cascade delete active so the dependent grade records also delete?

    Advise no spaces in naming convention, even in table/query/form/report names.
    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: 5
    Last Post: 08-24-2017, 09:03 PM
  2. Replies: 2
    Last Post: 03-16-2017, 05:50 AM
  3. Replies: 3
    Last Post: 07-15-2016, 03:17 PM
  4. Action on record before PK is created (record saved)
    By chris.williams in forum Forms
    Replies: 4
    Last Post: 09-14-2012, 10:41 PM
  5. Replies: 1
    Last Post: 09-21-2010, 09:49 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