Hello,
I'm trying to run an update query on an Excel sheet I have.
Below is the SQL I'm running but it's giving me a syntax error and I can't find where I'm going wrong:
I have a feeling that it might have to do with the way I'm running it:
I'm using an odbc connection to the Excel file. Maybe this type of connection is not suitable for update-queries??
Any ideas will be appreciated.
Cheers,
Roel
I'm trying to run an update query on an Excel sheet I have.
Below is the SQL I'm running but it's giving me a syntax error and I can't find where I'm going wrong:
Code:
SQL_Update_Source_OPP = "UPDATE `'OppTracking TAB Delimited-v2$'` A "
SQL_Update_Source_OPP = SQL_Update_Source_OPP & "SET A.[Current_Sales_Stage] = 'Lead' " & vbNewLine
SQL_Update_Source_OPP = SQL_Update_Source_OPP & "WHERE A.[Current_Sales_Stage]='05. Lead' " & vbNewLine
SQL_Update_Source_OPP = SQL_Update_Source_OPP & "SELECT A.* FROM `'OppTracking TAB Delimited-v2$'` A;"
I have a feeling that it might have to do with the way I'm running it:
Code:
With Workbooks.Open(DBQ).Sheets("OppTracking TAB Delimited-v2")
.QueryTables.Add(Connection, .Cells(1, 1), SQL_Update_Source_OPP).Refresh
End With
I'm using an odbc connection to the Excel file. Maybe this type of connection is not suitable for update-queries??
Any ideas will be appreciated.
Cheers,
Roel