Results 1 to 4 of 4
  1. #1
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14

    Grouping tables together in one query to extend a field...

    Hi,



    I suppose my title doesn't particularly makes sense but that's because I'm not sure how to describe and probabaly why I couldn't find anything similar to this...

    I have a table which contains data on students eg: Name, Age. Another table consists of all the test scores throughout the year(s) for a particular student ie: there is one table per student. Therefore I made a relationship between all of the individual tables to the main one with the students name (as this is, for now, the primary key).

    Every now and then, I have to print off a 'mark sheet' style report which is easy enough to design however I want it to consist of the student's name followed by his score on a particular test. Each report consists of the test scores for one test for all the students. Currently I have to go to each student's table and copy the respective test score into a new table and paste it next to the corresponding student's name; this is a very long and mistake-prone process.

    My question then: Is it possible to design a query which picks out the students name and their test score for a certain test and puts them all 'underneath' each other in a record and if not what is the best way to do this? Should I put all the data into one table then query out individual tests?

    I tried to make a simple table-style query below to try make it clearer...

    Name Test 24 Score
    John Smith 19
    John Smith2 24
    ...... ..
    ...... ..
    ...... ..
    ...... ..

    Thanks in advance
    AA93

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    there is one table per student...Should I put all the data into one table then query out individual tests
    All of the test scores should be in 1 table. That table should be joined to your student table. Like this:

    tblStudents
    -pkStudentID primary key, autonumber
    -txtFName
    -txtLName
    other fields

    tblStudentTestScores
    -pkStuTestScoreID primary, key, autonumber
    -fkStudentID foreign key to tblStudents (must be a long integer number data type field)
    -score
    -dteScore (a date field identifying the date of the test score)
    other fields

    You can then create a form based on the student table and then create a subform based on the score table.

  3. #3
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14
    Are you sure there is no way to just append the data below one another?? The problem is that I don't directly enter the data into the DB. We import all the data from a text file into the database for each test.

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Having a normalized table structure is critical to a succesful relational database application. You would base all of your forms, reports & queries on these tables. My recommendation is to create that normalized structure first. Then import your data into temporary tables and then use append queries to move the data into the normalized tables. Once the data has been moved, remove the temporary tables.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-25-2012, 01:01 PM
  2. Replies: 4
    Last Post: 01-04-2012, 02:35 PM
  3. Replies: 5
    Last Post: 06-22-2011, 08:47 PM
  4. Split Query Field into Sub Queries/Tables
    By maggioant in forum Queries
    Replies: 0
    Last Post: 10-15-2009, 05:23 PM
  5. Access report with 3 tables -grouping,sorting
    By kartechy in forum Reports
    Replies: 0
    Last Post: 07-22-2009, 09:07 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