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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query for current record only

Status
Not open for further replies.

goslincm

MIS
May 23, 2006
292
US
Hi, I have a series of 10 update queries that I need to run upon completion of a form's data entry. Currently when it runs its updating all records, but at this point I only need the queries to update the current record. How do I tell each query to only update the current record that was input?
 
You could probably set the criteria in the update query to something like:

Forms![Name of Current Form]![Name of Primary key Field]

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
So how would that look in this query given the primary key field is AUTONO and the form name is REVIEW

INSERT INTO AUDITRPT_RESPONSE ( AUTONO, QUESTION_YN, QUESTION_NUM )

SELECT [AUDIT REVIEWS].AUTONO, [AUDIT REVIEWS].[05-10], "3" AS QUESTION_NUM

FROM [AUDIT REVIEWS];
 
btw: this is an append query, not an update query.
Try something like:
Code:
INSERT INTO AUDITRPT_RESPONSE ( AUTONO, QUESTION_YN, QUESTION_NUM )

SELECT [AUDIT REVIEWS].AUTONO, [AUDIT REVIEWS].[05-10], "3" AS QUESTION_NUM
FROM [AUDIT REVIEWS]
WHERE [AUTONO] = Forms!Review!AUTONO;


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top