I have a table (tblGroupCases) where I am attempting to update a particular field, the problem is that in order to do this I have to join three tables. Two of these tables (Officers and Assoc_Inc_Off) are located in a different MS SQL db. I was thinking about creating a view joining the first two tables then using vb code to join the View and the table that I want to update. My question is can I join three tables in an Update query?
The following is my failed attempt, tblGroupCases is the table I want to update with the data contained in the Officers table but I need to connect these two (2) table via the Assoc_Inc_Officer Table:
VB Code:
strSQL = "UPDATE GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases " strSQL = strSQL & "SET GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases.Subject_Officer = " strSQL = strSQL & "IADATA.DBO.OFFICERS.LNAM " strSQL = strSQL & "FROM GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases, " strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF, IADATA.DBO.OFFICERS " strSQL = strSQL & "WHERE GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases.INCNUM = IADATA.DBO.ASSOC_INC_OFF.INCNUM " strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF.INCNUM = IADATA.DBO.Officers.INCNUM;"
If I remove the last line:
VB Code:
strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF.INCNUM = IADATA.DBO.Officers.INCNUM;"
The code runs but it doesn't update the field.
Thank you,




Reply With Quote