Update query, adding to existing records

gowans07

Registered User.
Local time
Today, 03:02
Joined
Sep 27, 2011
Messages
36
I'm trying to create a query in which depending on which record is selected in Frm_News it will add that record to an existing record in Tbl_Temporary details. Is this possible?

Thanks TG
 
I think that should be possible with an Update query.
To help you more I think we would need to know:
The name of the table to be updated
The name of the fields that are to be updated
The names of the controls on the form that show the data to be used
The Pk data of the record that is to be updated
 
Table to be updated: Tbl_TemporaryDetails
Fields to be updated: News Item and Web Link
Control names in Frm_News: TxtNewsItem and TxtWeblink
Primary Key in Tbl_TemporaryDetails: Order Number

Cheers
 
I'm not 100% sure this is right, so, MAKE A BACKUP please, before you try the query below.

UPDATE Tbl_TemporaryDetails SET Tbl_TemporaryDetails.[News Item] = Forms!Frm_News![TxtNewsItem], Tbl_TemporaryDetails.[Web Link] = Forms!Frm_News![TxtWeblink]
WHERE (((Tbl_TemporaryDetails.[1TblID])=[Forms]![Frm_News]![2TblID]));
 
Awesome managed to solve


UPDATE Tbl_TemporaryDetails SET [News Item] = [Forms]![Frm_NewsSelector]![TxtNewsItem], [Web Link] = [Forms]![Frm_NewsSelector]![TxtWebLink];
 
Without a WHERE clause, I think that will update every record to the new values. Is that really what you want?
 
Bob is quite right -- with an update query the where clause is needed to restrict the update to specific records.

As the info at the link says

SQL UPDATE Warning

Note: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
 
Last edited:
Thanks for the replies, yeh its fine i wish to update all the records within that table, its a temporary table in which when an order is in process it is held in there, once its completed the records are deleted from the table.
 

Users who are viewing this thread

Back
Top Bottom