I am trying to update local Access 2007 table with records from BE SQL Server 2012 Express. My steps here:
In SQL Server exists Stored Procedure with 4 parameters to get needed records;
In Access VBA there is function to call SP and make temporary query:
Public Function UpdateLocalSQLTable(strTable As String, strSQL As String, strSQL1 As String) As Boolean On Error GoTo Err_Handler Dim qdf As DAO.QueryDef Dim strQuery As String Dim conConnectString As String strQuery = "qryTemp" DoCmd.Close acTable, strTable If IsQueryExists(strQuery) Then DoCmd.DeleteObject acQuery, strQuery conConnectString = GetUserParams(NetConnDat) Set qdf = CurrentDb.CreateQueryDef(strQuery) With qdf .Connect = conConnectString .SQL = strSQL .Close End With CurrentDb.Execute strSQL1 UpdateLocalSQLTable = True qdf.Close Exit_Handler: Set qdf = Nothing Exit Function Err_Handler: Call LogError(Err.Number, Err.Description, "UpdateLocalSQLTable", , True) Resume Exit_Handler End Function
Here are two SQL strings passed to subroutine:
strSQL=EXEC [dbo].[usp_TabelMakeTmpTable] @strEmp='0033111',@strMon='2014.12',@strDep='STR',@strPam='STR3' strSQL1=UPDATE tbl_tmp_Tab_s INNER JOIN qryTemp ON tbl_tmp_Tab_s.EmplCodeID0 = qryTemp.EmplCodeID0 SET tbl_tmp_Tab_s.GraphHrs = [qryTemp]![GraphHrs];
I get query "qryTemp" created well but on UPDATE statement I get error 3073. "Operation must use updateable query".
What's wrong with it?