how can i call stored procedure?

K

khaled adam

I am using SQL Server 2000, with an MS Access 2000 front
end. I want an event to be called when a button is
clicked from a form. I want this event to call a stored
procedure, pass it a parameter (from another field on the
form)
 
T

TF

Hello,
I use this VBA code in ADP project to call "sp_AddUnit" stored procedure
(it has one input and one output parameters :
' *************** Code start
Dim Cmd As New ADODB.Command
Cmd.Parameters.Append Cmd.CreateParameter("N_Unite", adInteger,
adParamOutput)
Cmd.Parameters.Append Cmd.CreateParameter("Unite", adVarChar, adParamInput,
Len(Frm!unite), Frm!unite)
Cmd.CommandText = "sp_AddUnit"
Cmd.CommandType = adCmdStoredProc
Set Cmd.ActiveConnection = CurrentProject.Connection
Cmd.Execute
ADO_AjouterUnite = Cmd.Parameters("N_Unite").Value
Set Cmd = Nothing
' *****************Code End
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top