Posted by nicolec on 09/26/25 11:26
Here's a sample that pulls the variable from a form and passes it to a
stored procedure:
'Declare variables
Dim cmd As ADODB.Command
Dim prm As Parameter
'Set connection and command properties
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "spMyProcedure"
'Set parameters
Set prm = cmd.CreateParameter("@myVariable", adInteger, adParamInput)
cmd.Parameters.Append prm
prm.Value = Forms!myForm.myVariable.Value
'Run Command
cmd.Execute
'Cleanup resources
Set cmd = Nothing
Set prm = Nothing
Navigation:
[Reply to this message]
|