Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Unequal multi-table update statement (Access)

Posted on 2008-10-03
4
Medium Priority
?
626 Views
Last Modified: 2011-10-19
My wife needs a database for her work in a school. It needs to track student reading scores and compare them to a target.

The way the target goal is figured out is to look at the first score for a student in a quarter and then add 2.5 (correct words per minute) per school week until the end of the quarter.

I made a table, tblSchoolWeeks, that has each week of the school year in it along with the increase amount based on where it falls in the quarter. That way some weeks, like during winter or spring breaks, dont count towards increasing the reading level.

So what I need help with, well that would be everything, what I most need help with is with an update query. A reading score and test date is entered into tblTestScores. What I want the update query to do is grab the first test score for that student in that quarter and then add the appropriate target increase number based on when the test took place (if it took place in the 3rd week of a quarter then the target is the first score for that quarter plus 5 points).

If you could help with the update query or if you have a better way of doing this I would appreciate it.

Attached is a picture of the current table layout.

Thanks.

TableExamples.JPG
0
Comment
Question by:zabu99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:AaronAbend
ID: 22636337
create view studentstartscoredate as select studentid, min(testdate) mintestdate from testscores

create view studentstartscore as select ts.studentid, ts.score
from testscores ts, studentstartscoredate tsd
where ts.studentid = tsd.studentid
and ts.testdate=tsd.testdate

select sw.startdate, sw.enddate, s.studentname, ss.score*sw.targetincrease/100.0 targetscore
from schoolweeks sw, students s, studentstartscore ss
where s.studentid= ss.studentid
order by ....

I have not tested this but you may get the idea from it.  You are going to get one row for each student for each week. So 10 students, 10 weeks, 100 records.

be careful - if ss.score is an integer, the result will be an integer.  
 
You can use temp tables intead of views... it may be easier
0
 
LVL 10

Accepted Solution

by:
AaronAbend earned 2000 total points
ID: 22636347
Error!!!
create view studentstartscoredate as select studentid, min(testdate) mintestdate
from testscores
GROUP BY STUDENTID

sorry about that...
0
 
LVL 5

Author Comment

by:zabu99
ID: 22637135
That's going to take me a couple of minutes to wrap my brain around, but I'll get right on it. Thanks.
0
 
LVL 5

Author Closing Comment

by:zabu99
ID: 31502838
Sorry to leave you hanging so long, I took on a bit of a cold on accident.

Yeah, if I modify this a little bit it should do the trick. Thanks for the (huge) push in the right direction.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question