Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Proc from Access 1

Status
Not open for further replies.

mlpaskett

Programmer
Aug 27, 2004
7
0
0
US
How can I call a stored procedure on SQL 2000 from an Access 2003 database?


Thanks--
Mark
 
You can create a pass-through query in access which sends the correct sql commands eg exec storedprocname.
Look up sql specific queries in the help.
 
This an example

Public Function GetNextOrdNo(cnn As ADODB.Connection) As String

Dim rst As ADODB.Recordset
Dim vResult As Variant
Dim oCmd As New ADODB.Command

GetNextOrdNo = "00000000"
With oCmd
Set .ActiveConnection = cnn
.CommandType = adCmdStoredProc
.CommandText = "GetNextOrderValue" ' name of stored procedure
' get parameter set from SP
.Parameters.Refresh
' set value of first parameter
'.Parameters("@InputData").Value = "10-37-3394"
.Execute
' get result from output parameter
vResult = .Parameters("@NextOrderValue").Value
End With
GetNextOrdNo = vResult
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top