B
bmd473
I am trying to run a stored procedure from Access using the following
code, I am receiving a "Syntax Error or Access Violation" when I try
to run it. If I paste the code directly in to sql and run it, it
works fine. Any help would be appreciated. I want to do this
complete through code and not using a passthrough query if possible.
Thanks
Private Sub Command0_Click()
Dim conn As String
conn = "Provider=SQLOLEDB;" & _
"Data Source = servername;" & _
"Initial Catalog=dbname;" & _
"Integrated Security=SSPI"
Dim ds As New ADODB.Command
Dim sql As String
sql = "ForTim"
Dim parm As String
parm = "jill"
With ds
..ActiveConnection = conn
..CommandText = sql & " '" & parm & "'"
..CommandType = adCmdStoredProc
..Execute
End With
End Sub
code, I am receiving a "Syntax Error or Access Violation" when I try
to run it. If I paste the code directly in to sql and run it, it
works fine. Any help would be appreciated. I want to do this
complete through code and not using a passthrough query if possible.
Thanks
Private Sub Command0_Click()
Dim conn As String
conn = "Provider=SQLOLEDB;" & _
"Data Source = servername;" & _
"Initial Catalog=dbname;" & _
"Integrated Security=SSPI"
Dim ds As New ADODB.Command
Dim sql As String
sql = "ForTim"
Dim parm As String
parm = "jill"
With ds
..ActiveConnection = conn
..CommandText = sql & " '" & parm & "'"
..CommandType = adCmdStoredProc
..Execute
End With
End Sub