Student markbook db - access 2013 - multiple table joins

Markthearm

New Member
Joined
Jun 20, 2018
Messages
6
Hi all,
hoping for some help...
I've constructed a student mark book database with the following tables -

TblStudents

<tbody>
</tbody>
TblResultsTblAssessment
StudentIDResultsIDAssessmentID
StudentEmailStudentIDTitle
StudentNameAssessmentIDDate
TutorMarkTotalMarks
GenderTest,Y/N
MTGYear12?
Group
TutorGroup
StudentInactive
AQAASBiologyGrade

<tbody>
</tbody>

works great, typical result being:

FrmShowResults
StudentNameTitleMark
Doe, JohnDNA HW19
Doe, JohnPlant cells12
Smith, JaneDNA HW17
Smith, JaynePlant cells20

<tbody>
</tbody>

However, the head of department has asked me if I can modify the db to show all students / all assessments on the same form, like this -

FrmShowResults
StudentNameTitleMarkTitleMark
Doe, JohnDNA HW19Plant cells12
Smith, JaneDNA HW17Plant cells20

<tbody>
</tbody>

Racked my brains trying to figure this out. Tried DLookup, but slow and there are over 60 assessments in the db.
Also tried adding copies of TblAssessment in the query builder, which worked, but I would need 60 copies of tblAssessment which would produce, I imagine, a huge SQL statement, with joins to each table. For example, just five copies of the AssessmentID table proudces the following SQL statement:

SELECT [TblResults redesign].StudentID, TblStudents.StudentName, [TblAssessment 1].Title, [TblResults redesign].Mark1, [TblAssessment 2].Title, [TblResults redesign].Mark2, [TblAssessment 3].Title, [TblResults redesign].Mark3, [TblAssessment 4].Title, [TblResults redesign].Mark4, [TblAssessment 5].Title, [TblResults redesign].Mark5
FROM TblStudents INNER JOIN ((((([TblResults redesign] INNER JOIN [TblAssessment 1] ON [TblResults redesign].Assessment1ID = [TblAssessment 1].Assessment1ID) INNER JOIN [TblAssessment 2] ON [TblResults redesign].Assessment2ID = [TblAssessment 2].Assessment2ID) INNER JOIN [TblAssessment 3] ON [TblResults redesign].Assessment3ID = [TblAssessment 3].Assessment3ID) INNER JOIN [TblAssessment 4] ON [TblResults redesign].Assessment4ID = [TblAssessment 4].Assessment4ID) INNER JOIN [TblAssessment 5] ON [TblResults redesign].Assessment5ID = [TblAssessment 5].Assessment5ID) ON TblStudents.StudentID = [TblResults redesign].StudentID
WHERE ((([TblResults redesign].StudentID)=1));

I feel sure there must be an easier way, but my Access/SQL knowledge doesn't stretch that far. I can find my way around VBA, although I am self taught, so a possible coding solution may help.

Thanks for any advice offered, even if it's 'no you can't really do that with a database', in which case I would pursue an Excel solution.
 
This is done with a cross tab query.
Code:
TRANSFORM Sum(Table4.Mark) AS SumOfMark
SELECT Table4.Assessment
FROM Table4
GROUP BY Table4.Assessment
PIVOT Table4.Student;

In the query builder you just add the row field (Student), Column Field (Assessment), and Value/Sum Field (Mark) - although here of course the summing of a single value is just the value itself.

However, it sounds like you might be a lot more comfortable using Excel.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Brilliant. Works great. Thanks xenou.
PS: Yes, I am more confident in Excel, but I can see the value of a db for this and I'm interested in learning more about databases. :)
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top