Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query issues

Status
Not open for further replies.

gogirl

MIS
Joined
Jun 5, 2002
Messages
46
Location
US
Hello, I've got 2 tables in a one-to-many relationship. The first table is called Summary and is the header data for a survey form. The second table is called Answers and obviously contains the answers on the survey form. However, 6 of the 27 answers should actually be in the Summary table. I've tried an update query by taking the primary key (OID), answer sequence (SEQ) and the answer value (SUBJ_VAL) and tried to update to a table called Report_Data where I added a seperate field for each value (CONTRACT#, MILESTONE, PRACTICE, etc...).

Code:
UPDATE Answers INNER JOIN Report_Data ON Answers.KPI_SRVY_PRNT_OID = Report_Data.KPI_SRVY_PRNT_OID SET Answers.SUBJ_VAL = Report_Data.[CONTRACT#]
WHERE (((Answers.SEQ)=1));

What happens is that the Report_Data table is not updated and it has deleted everything from the Answers table. Maybe I don't understand how the update query is supposed to work. Can someone please give me some guidance?

Thanks,

Cara
 
The basic syntax for an UPDATE query is as follows:
Code:
UPDATE [i][table you want to update][/i]
SET [i][field to update][/i] = [i]newvalue[/i]
WHERE [i]conditions if necessary...[/i]
Your code updates the values in the answers table currently.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Thanks for your help! I've got it working properly now. Using the design view in Access makes this very confusing. I was putting the Report_Data.CONTRACT# in the Update To field because I wanted to "update to" the field in that table. Lol.

Thanks Again,

gogirl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top