J
james
Hi,
I am normally on the Excel group - but I have had a porblem driving me
crazy all day.
I have an Access 2010 database, which I have saved as .mdb.
It has an update query in, which takes 2 string parameters. When I run
it from Access it works fine - asks me for the 2 parameters then
updates the table accordingly.
However, I am trying to run it from Excel VBA. At first I thought the
issue was the parameters, so I created another update query which
takes 0 parameters. The continual error I get is 'Operation must use
an updateable query'.
It goes without saying that I can connect to the database, and I can
run normal Select statements - anyone got any ideas? Code below:
(obviously the execute line is the one that gives the error).
Function RunUpdateQuery(objConn As ADODB.Connection)
Dim objCommand As ADODB.Command
Set objCommand = New ADODB.Command
With objCommand
.ActiveConnection = objConn
.CommandType = adCmdStoredProc
.CommandText = "qryTest"
.Execute
End With
End Function
I am normally on the Excel group - but I have had a porblem driving me
crazy all day.
I have an Access 2010 database, which I have saved as .mdb.
It has an update query in, which takes 2 string parameters. When I run
it from Access it works fine - asks me for the 2 parameters then
updates the table accordingly.
However, I am trying to run it from Excel VBA. At first I thought the
issue was the parameters, so I created another update query which
takes 0 parameters. The continual error I get is 'Operation must use
an updateable query'.
It goes without saying that I can connect to the database, and I can
run normal Select statements - anyone got any ideas? Code below:
(obviously the execute line is the one that gives the error).
Function RunUpdateQuery(objConn As ADODB.Connection)
Dim objCommand As ADODB.Command
Set objCommand = New ADODB.Command
With objCommand
.ActiveConnection = objConn
.CommandType = adCmdStoredProc
.CommandText = "qryTest"
.Execute
End With
End Function