Using SQL in Access, trying to “Update” a table, with the user name, from another table.
The 3rd line below (SQLnm2…) says error-2465 cant find field ‘|’.
I’ve tried changing the expression many ways but no success.
Any assistance would be greatly appreciated.
Dim SQLnm As String
Dim SQLnm2 As String
SQLnm2 = SQLnm2 & "', '" & [Employees]![NBK] & "');"
SQLnm = " Update tbl_DateTracking SET NBK = "
SQLnm = SQLnm & "'" & SQLnm2 & "' WHERE "
SQLnm = SQLnm & "CaseId = '" & CaseId & "' AND OCC_Scenario = '" & OCC_Scenario & "';"
DoCmd.RunSQL SQLnm
You have a close bracket where it is not opened on your third line.
You are also not stating which column to update. It appears you want to update 2 columns, the first being NBK with an empty value. The second is tricky as you either want to update your column called Name or update another column to the value of employee.name.
Your code concatenates to
Your code needs to state what column is the Employee Name.
EG
or maybe you meant
Until I know how many columns you’re trying to populate (and with what value), I can’t provide SQL code.
As a guide for context: