I have a form linked to database access sql server,
and have a command button that opens when you click a Stored.
I have stored this 2 variables, I would click the
button, pull the value of two fields in the form for the variables to
thus open the query, I tried in many ways, but failed.
I wish somebody would help me to
NAME OF STORED: Form PRD_PRE_PEDIDO_EXPORTA_PROFORMA
NAME OF VARIABLE: @ @ PPrePedidoCodigo PCodEmpresa and both are type INTEGER
NAME OF FIELDS IN THE FORM: Me.CodEmpresa and Me.Prepedidocodigo
Code that did
Private Sub BtnExportaProforma_Click ()
Dim cnn As ADODB.Connection
Dim cmd As New ADODB.Command
Dim prm The ADODB.Parameter
Set cnn = CurrentProject.Connection
Set cnn = cmd.ActiveConnection
cmd.CommandText = "dbo. [Form PRD_PRE_PEDIDO_EXPORTA_PROFORMA]
cmd.CommandType = adCmdStoredProc
Set prm = cmd.CreateParameter (PCodEmpresa "adInteger, adParamInput,, Me.CodEmpresa)
cmd.Parameters.Append prm
Set prm = cmd.CreateParameter (PPrePedidoCodigo "adInteger, adParamInput,, Me.PrePedidoCodigo)
cmd.Parameters.Append prm
Cmd.Execute
End Sub