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

Using DMax in Update query

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
0
0
GB
I have a table which has a field for leaving date. This table will have duplicate records whereby 1 customer number may have 3 different leave dates.

I need to update the most recent leave date in table 1 with the leave date from table two but I can't figure out how to use dmax.

Can it be done?
 
My current query is a simple update query:

Code:
UPDATE [tblEuropean Attrition Report] INNER JOIN tblAttrition ON [tblEuropean Attrition Report].[SAP No] = tblAttrition.[SAP no] SET [tblEuropean Attrition Report].[Leaving Date] = [tblAttrition].[Leave date];

SAP No = number
Leave Date = DateTime

tblEuropean Attrition Report has the duplicate records.

tblAttrition has the leave date I want to update
 
Your SQL suggests you want to update [tblEuropean Attrition Report].[Leaving Date] but your post states "tblAttrition has the leave date I want to update".
I think you want something like:


SQL:
UPDATE tblAttrition
SET [Leave date] = DMax("[Leaving date]","[tblEuropean Attrition Report]","[SAP No]=" & [SAP No])

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top