I have a simple SQL statement that updates records in a table from records in the same table. The SQL works fine in SQL 2008 Server Management Tool as a stored procedure. When I try to run it via the DoCmd.RunSQL it gives me a runtime error 3075 with a message of a syntax error (missing operator). I copy the exact string Access is creating and paste it into a SQL2008 script and it save it as a stored procedure and it executes perfectly.
Obviously there is some limitations or differences between Access DoCmd.RunSQL and running a stored procedure directly in SQL 2008. I am able to run other SQL commands but so far nothing with an INNER JOIN.
Here is the Code:
strSQL = "UPDATE t1 " & _
" SET LaneIdx = t2.LaneIdx, " & _
" StyleIdx = t2.StyleIdx, " & _
" SizeIdx = t2.SizeIdx, " & _
" GradeIdx = t2.GradeIdx , " & _
" LabelIdx = t2.LabelIdx " & _
" FROM dbo_TblLaneCfgDet t1 " & _
" INNER JOIN dbo_TblLaneCfgDet t2 on t2.LaneIdx = t1.LaneIdx " & _
" AND t2.LaneCfgHdrIdx = " & OrigLaneCfgHdrIdx & _
" WHERE t1.LaneCfgHdrIdx = " & NewLaneCfgHdrIdx
If someone can tell me how to fix the syntax so that it will work for Access that would work.
If not, can someone show me the Access 2003 syntax to call a stored procedure from SQL 2008 including the connection logic:
The stored procedure method is preferred, but I am having problems with the exact syntax from Acess 2003. I call stored procedures in Visual 2008 C# without any problems, very straightforward syntax, but I am having problems in Access. The help in Access 2003 is limited at best (at least for me).