Hi Folks -
I have an update query that I need to modify. There are situations where the CCTEMP.Short_Code is not unique and order to make it unique, I need to bring in another column.
This is my current code:
Code:
strStep = "Step 5 : Update Cost Center Info"
strSQL = "" & _
"UPDATE [Global_Monthly_Headcount]" & _
"INNER JOIN [CCTEMP]" & _
"ON [Global_Monthly_Headcount].[Cost Center - Short Name] = [CCTEMP].[Short_Code]" & _
"SET" & _
"[Global_Monthly_Headcount].[Cost Center - Long Name] = Nz([CCTEMP].[Long_Code], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Division] = Nz([CCTEMP].[Division], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Function] = Nz([CCTEMP].[Function], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Subfunction] = Nz([CCTEMP].[Subfunction], Null);"
db.Execute strSQL, dbFailOnError
But I want to use this but it just runs and runs and runs and doesn't complete. How would I go about achieving this?
Code:
strStep = "Step 5 : Update Cost Center Info"
strSQL = "" & _
"UPDATE [Global_Monthly_Headcount]" & _
"INNER JOIN [CCTEMP]" & _
"ON [Global_Monthly_Headcount].[Cost Center - Short Name]+Nz([Global_Monthly_Headcount].[Cost Center - Division],""foo"") = [CCTEMP].[Short_Code]+Nz([CCTEMP].[Division],""foo"")" & _
"SET" & _
"[Global_Monthly_Headcount].[Cost Center - Long Name] = Nz([CCTEMP].[Long_Code], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Division] = Nz([CCTEMP].[Division], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Function] = Nz([CCTEMP].[Function], Null)," & _
"[Global_Monthly_Headcount].[Cost Center - Subfunction] = Nz([CCTEMP].[Subfunction], Null);"
db.Execute strSQL, dbFailOnError