Update query for a particular ID's last record. (1 Viewer)

mahenkj2

Registered User.
Local time
Today, 06:46
Joined
Apr 20, 2012
Messages
459
I want to update a particular bottleFK's last entry of a table from a form's reference but it updates all the bottleFK records of that table.

UPDATE tblTransaction SET tblTransaction.UnloadingTime = Now(), tblTransaction.Unloadedby = [currentuser]
WHERE (((tblTransaction.BottleFK)=DLast("[forms]![frmLoad].[bottleid]","tbltransaction")));

Can somebody help to find what is wrong here.

regards.
 

mahenkj2

Registered User.
Local time
Today, 06:46
Joined
Apr 20, 2012
Messages
459
Solved.

I was doing wrong, how can a last record be found without last date, so include the relevant field.

UPDATE tblTransaction SET tblTransaction.UnloadingTime = Now(), tblTransaction.Unloadedby = [currentuser]
WHERE (((tblTransaction.BottleFK)=[forms]![frmload].[bottleID]) AND ((tblTransaction.LoadingTime)=DMax("loadingtime","tbltransaction")));
 

Users who are viewing this thread

Top Bottom