Question

I'm creating a database to track my students' participation in classes. This is what I've set up so far. I'm working in Access 2007.

Participant Master table - name, contact info, enrolled class, enrolled semester. Enrolled class (Class A, Class B, Class C) and enrolled semester (Semester 1, Semester 2) are defined in tables. Primary key is an autoincrement number but students all get a school ID number (ParticipantID).

Query1 pulls name & address for students enrolled in class A, semester 2 (SELECT name, address FROM ParticipantMaster WHERE EnrClass = "Class A" and EnrSem = "Semester 2"). The query works.

DailySessionLog is a table to represent each daily class. Includes fields for date, instructor name (check from list), discusssion topic (check from list).

Now I want to link DailySessionLog to Query1 -- letting me check off every day whether a student was there for None, Partial, Half, or Full session that day. I'm having trouble linking these and creating a subform. Any help?

I tried having a ParticipantID field in DailySessionLog which I linked to ParticipantID in Query1. It doesn't recognize if it's a one:one or :many relationship. If I go ahead and create a subform using the Access wizard it treats the Participant data as the "higher" form and the DailySessionLog data as the "sub" form. I want it to be the other way around.

Thanks for helping!

Was it helpful?

Solution

To create a one-to-one or one-to-many relationship, you should link DailySessionLog to ParticipantMaster rather than to Query1. You would then create a query to show the daily session logs of a given class for a given semester. Example:

SELECT {field list} FROM ParticipantMaster INNER JOIN DailySessionLog ON {join expression} WHERE ParticipantMaster.EnrClass = "Class A" AND ParticipantMaster.EnrSem = "Semester 2"

However, it would be better to use variable parameters rather than hard-coded strings. Example:

SELECT {field list} FROM ParticipantMaster INNER JOIN DailySessionLog ON {join expression} WHERE ParticipantMaster.EnrClass = [ClassName] AND ParticipantMaster.EnrSem = [SemesterName]

Or, to use a value from a control on an open form:

SELECT {field list} FROM ParticipantMaster INNER JOIN DailySessionLog ON {join expression} WHERE ParticipantMaster.EnrClass = [Forms]![FormName]![ClassControlName] AND ParticipantMaster.EnrSem = [Forms]![FormName]![SemesterControlName]

EDIT

Actually, you want to use this AND xQbert's idea, so, with table names like this for brevity:

Participants (a.k.a. ParticipantMaster)
Sessions (a.k.a DailySessionLog)
ParticipantSession (a.k.a. Participant_daily_session_log)

the first query would be more like this:

SELECT {field list}
FROM
    Participants
    INNER JOIN ParticipantSession ON Participant.ID = ParticipantSession.ParticipantID
    INNER JOIN Sessions ON ParticipantSession.SessionID = Session.ID

OTHER TIPS

Where do you intend the database to "Store" the participation?

I think the problem is you need another table: a Particpiant_Daily_sessioN_log which would store the results of your daily log for each student participation.

Think about the table dailysessionlog you don't want instructor name, topic and date listed for EACH student do you?

So what you have is a many students may attend class and a class may have many students. This means you have a many to many which needs to be resolved before access can figure out what you want to do.

Think of the following tables: Participant (ParticipantID) Class (ClassID) Session (SessionID, ClassID) ClassParticipants (ClassId, ParticipantID, Semester, year SessionParticipants (SessionID, ClassID, ParticipantID)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top