Results 1 to 3 of 3
  1. #1
    Albathien is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    2

    Form filtering and adding records to subform

    Hi, I am currently trying to create a DB for registering and tracking Trainees signing up for set courses.
    This is the base Structure:
    Click image for larger version. 

Name:	DB_Tables.png 
Views:	9 
Size:	37.9 KB 
ID:	16409

    I am stuck on the actual registration form:

    Click image for larger version. 

Name:	Screenshot 2014-05-09 14.50.56.png 
Views:	10 
Size:	55.9 KB 
ID:	16408

    The idea is that I would type in a date, then the Course Combo would list the courses available on that date. Choosing an item on the list would select the record for that particular event and populate the rest of the fields in the main form. The subform would then show sign-ups for that event (filtered on Event_ID).

    I have 2 problems.

    The first is that the main form is not filtering the records for the event after I choose one from the drop-down. This was working, but I somehow broke it.

    Secondly, I would like to be able to add new records to the sub-table ie. add new trainees to a particular event. However when I try to do this, I get an error "... cannot find a record in the Table 'GRADES' with matching key field(s) 'GradeID'". I suspect that Access is creating the wrong hierarchy with the SQL code, but I cannot work out what the syntax is to create this structure in the form Record Source SQL code, this is what Access creates:

    Code:
    SELECT MAIN.Main_ID,
    MAIN.EventID,
    MAIN.PersonnelID,
    PERSONNEL.Pers_ID,
    PERSONNEL.Forename,
    PERSONNEL.Surname,
    PERSONNEL.Email,
    PERSONNEL.GradeID,
    GRADES.Grade_ID,
    GRADES.GradeName,
    PERSONNEL.BaseID,
    BASES.Base_ID,
    BASES.BaseName,
    MAIN.UNA,
    MAIN.UNA_Date,
    MAIN.DNA
    
    FROM (GRADES
       INNER JOIN (BASES
          INNER JOIN PERSONNEL
          ON BASES.[Base_ID] = PERSONNEL.[BaseID])
       ON GRADES.[Grade_ID] = PERSONNEL.[GradeID])
       INNER JOIN MAIN
       ON PERSONNEL.[Pers_ID] = MAIN.[PersonnelID];
    This is the hierarchy for the subform I'm using, which I think it should reflect.
    Click image for larger version. 

Name:	Reg_Sub_Hier.png 
Views:	9 
Size:	24.8 KB 
ID:	16410



    I would appreciate any help I can get on explaining why the main form isn't filtering, and what the correct syntax should in Access SQL for Multiple Links and Nested links.

    Thanks in advance

    EDIT: Link to the file in my Dropbox https://dl.dropboxusercontent.com/u/...urse_Reg.accdb
    Last edited by Albathien; 05-09-2014 at 06:42 PM.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Do you have a 5-6 line description, in plain English, of WHAT you are trying to do? I do not understand the purpose of MAIN.

    Seems you have
    -People and Courses.
    -Courses can be given in different Sessions and
    -Courses can be given at different Locations.

    Other facts that may be involved:
    - A Person can be "assigned" to take a Course
    - The Person may attend or not
    - The Person receives a Grade

    I always recommend a statement related to Business facts/rules; then
    some test data based on those facts; and develop an evolving data model of the facts.
    Test the model with the test data; reconcile every anomaly--is it data? is it the model? is there another business rule?
    - change as necessary and repeat the tests until you have reconciled every issue.

    Now start development of Forms, Queries, Reports etc.

  3. #3
    Albathien is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    2
    I appreciate your quick response,

    Yes sorry, The purpose of MAIN is to create the link between People and Events (particular courses).
    I have done this so that I can keep a historic record of who attended which events.

    So:
    - An Event is a Course that has been assigned a date, time, venue, trainer, etc. This has a unique ID
    - Personnel are people that can be assigned to a particular Event. (Trainees). These have a unique ID
    - A person can cancel their sign-up (UNA), the Date when they cancel must be registered.
    - A person can not show up to the Event (DNA)
    - An Event can be cancelled. A reason and date must be registered.

    Here grade is actually Personnel Pay-Grades.

    Thanks

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

Similar Threads

  1. Filtering Master Records and Subform Child Records
    By Nerther in forum Programming
    Replies: 6
    Last Post: 10-01-2013, 05:24 PM
  2. Adding/Editing Records through a subform
    By Antinomy in forum Forms
    Replies: 17
    Last Post: 06-30-2012, 07:29 PM
  3. Adding new partial records to a subform
    By DarkWolff in forum Forms
    Replies: 7
    Last Post: 03-06-2012, 04:05 PM
  4. Adding Records in a Subform
    By chris.williams in forum Forms
    Replies: 3
    Last Post: 10-14-2011, 01:21 PM
  5. Adding multiple records in subform
    By randolphoralph in forum Programming
    Replies: 1
    Last Post: 05-12-2010, 09:42 PM

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