how can i call stored procedure?

  • Thread starter Thread starter khaled adam
  • Start date Start date
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)
 
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
 
Back
Top