View Full Version : update table from query


mediacentervn
05-24-2008, 10:57 PM
i have a query that calculated the subjective marks of student:
student name............ question no..................... subjectivescore
student1........................1.1............... ................... 6.7
student1........................1.2............... ................... 4.7
student2........................1.1............... ................... 6.7
student2........................1.2............... ................... 4.7
student3........................1.1............... ................... 6.7
student3........................1.2............... ................... 4.7
i want to create another query to update score in above query to table named: studentscore includes 4 fields: studentid (i have another table named students that include field studenid, studentname), question no (question no is the first number of [question no] in above query), objectivescore, subjectivescore (field subjective score = sum of subjective score), but i have an error massage: Operation must use an updateable query. :confused:. How will i solve that problem??

jal
05-25-2008, 10:53 AM
i have a query that calculated the subjective marks of student:
student name............ question no..................... subjectivescore
student1........................1.1............... ................... 6.7
student1........................1.2............... ................... 4.7
student2........................1.1............... ................... 6.7
student2........................1.2............... ................... 4.7
student3........................1.1............... ................... 6.7
student3........................1.2............... ................... 4.7
i want to create another query to update score in above query to table named: studentscore includes 4 fields: studentid (i have another table named students that include field studenid, studentname), question no (question no is the first number of [question no] in above query), objectivescore, subjectivescore (field subjective score = sum of subjective score), but i have an error massage: Operation must use an updateable query. :confused:. How will i solve that problem??
I'm not fully understanding what you are trying to do.

Probably the first thing you need to do is do an inner join of the query1 results with the students table so that you now have all the columns needed (and you can add the objectiveScore column in that process). Something like this

Select Q.*, S.*, 0 as ObjectiveScore INTO ObjectiveScores From Query1 as Q INNER JOIN Students as S ON S.StudentID = Q.STudentID

This creates a table called ObjectiveScores


At this point ObjectiveScore column will be 0 all the way down so you will need another query to update it's value (I don't know your formula).