
Executing MS SQL Server 2000 stored procs via MS Access 2000
To whom it may convern,
I am attempting to execute a MS SQL Server 2000 stored
proc from MS Access 2000.
I am getting an error (-2147217900) stating that I am
getting a 'syntax error or access violation'...
This error is being thrown on the ".Open cmdObject" line
at the bottom of the attached code snippet...
Any suggestions would be welcomed...
I'm not sure if I have my syntax correct to call a MS SQL
Server (that is running on locally on my
machine, 'mySQLServer') or if its some flakey coding
issue....
Here's the code that I have so far:
-----------------------------------------------------
Dim cnnObject As ADODB.Connection
Dim cmdObject As ADODB.Command
Dim rstObject As ADODB.Recordset
'Create connection object
Set cnnObject = New ADODB.Connection
'Set up connection string
cnnObject.ConnectionString
= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=targetDb;Data
Source=mySQLServer"
'Open the connection
cnnObject.Open
'Create command object
Set cmdObject = New ADODB.Command
With cmdObject
.ActiveConnection = cnnObject
.CommandType = adCmdStoredProc
.CommandText = "sp_copyTable 'parm1', 'parm2'"
.CommandTimeout = 100
End With
'Create record set object
Set rstObject = New ADODB.Recordset
With rstObject
.CursorLocation = adUseServer
.CursorType = adOpenStatic
.Open cmdObject
End With