VBA Access 2007 SQL 2008 stored procedures
Hi,
have Access 2007 forms running on SQL server 2008. I am trying to get the following code I ahve seen in this forum running but now sure about the sql query syntax that is passed to the database. Looking at the sql profiler the execute command looks like:
execute sp_patient '111' ', ' ' xcc' ' ,.... (swl add too many quotes...)
Also If I want to return the result set to another form, how that can be done?
Private Sub Command0_Click()
Dim cnn As ADODB.Connection
Dim rstOut As ADODB.Recordset
Dim strPeriod As String
Dim strCountry As String
Dim strType As String
strPeriod = Me.cmb_period
strCountry = Me.cmb_country
strType = Me.cmb_Type
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "EXEC SP_Patient " & " '" & strPeriod & "', '" & strType & "','" & strCountry & "'" .CommandType = adCmdText
.Execute
End With
End Sub
Many thanks in advance
|