Here is an example of calling a strored procedure using an ADO Connection. Use it as a reference, Information would need to be changed accordingly.
==========
Public Const ADOConnect As String = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DATABASENAMEHERE;Data Source=SERVERNAMEHERE"
Private Sub GetStoredProcedure()
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim adoCN As ADODB.Connection
Set adoCN = New ADODB.Connection ' Normally on initial open of application
adoCN.Open (ADOConnect) ' Normally on initial open of application
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = adoCN
.CommandType = adCmdStoredProc
.CommandText = "StoredProcNameHere"
' Use the following two lines if you have a parameter to pass
'Set paritem = .CreateParameter("Keyword", adVarChar, adParamInput, 255, Me.txtValue)
'.Parameters.Append paritem
End With
Set rs = New ADODB.Recordset
rs.Open cmd, , adOpenStatic
' Do whatever you want here .......
Set rs = Nothing
Set cmd = Nothing
Set adoCN = Nothing
End Sub
========== Jim Lunde
compugeeks@hotmail.com
Custom Application Development