Sub Execute_PassThroughQuery()
Dim cat As ADOX.Catalog
Dim cmd As ADODB.Command
Dim myRecordset As ADODB.Recordset
Dim strConnect As String
strConnect = "Provider=SQLOLEDB;Data Source=yourServer\yourName;" & _
"Initial Catalog=Northwind;User Id=sa;Password="
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set cmd = New ADODB.Command
Set cmd = cat.Procedures("French Customers").Command
Set myRecordset = cmd.Execute
Debug.Print myRecordset.GetString
Set myRecordset = Nothing
Set cmd = Nothing
Set cat = Nothing
End Sub
|