doco
Power User
- Local time
- Today, 15:48
- Joined
- Feb 14, 2007
- Messages
- 482
Example
The following example updates the Employees table, changing each sales manager's title to Regional Sales Manager:
Public Sub DoSQL()
Dim SQL As String
SQL = "UPDATE Employees " & _
"SET Employees.Title = 'Regional Sales Manager' " & _
"WHERE Employees.Title = 'Sales Manager'"
DoCmd.RunSQL SQL
End Sub
Yet no manner of SQL statement is accepted without error. The following example is an oversimplification to make a point.
Code:
DoCmd.RunSQL "Select * from dbo_property"
' or even populating a variable
SQL = "Select * from dbo_property"
DoCmd.RunSQL SQL ' throws same error
Throws Run Time error '2342' : "A RunSQL action requires an argument consisting of an SQL statement"
Even copy and paste SQL directly from Access QBE SQL editor of a query that does indeed work without error, throws the same error.
Any ideas?
TIA