N
Nick
There are three ways to run a sp in an ADP command
button. Do you need to just execute it, run it and return
a recordset or pass parameters and run it? to run it and
pass parameters is the most control:
'you need a connection to the DB, a command to hold the sp
'and a parameter to tell the command the parameters
dim cnn as adodb.connection
dim cmd as adodb.command
dim prm as adodb.parameter
dim rst as adodb.recordset
'set up the obejcts
set cnn = currentproject.connection
set cmd = new adodb.command
set rst = new adodb.recordset
'set the command to the connection and some properties
cmd.activeconnection = cnn
cmd.commandtext = "<your SQL proc name or a sql statement>"
cmd.commandtype = adcmdstoredproc
'repeat this for each parameter --
'return, inputs then output is the order from the sp!
set prm = cmd.createparmeter(fill in the stuff)
cmd.parameters.append prm
set rst = cmd.execute()
'now you have a command object with your result set, too
button. Do you need to just execute it, run it and return
a recordset or pass parameters and run it? to run it and
pass parameters is the most control:
'you need a connection to the DB, a command to hold the sp
'and a parameter to tell the command the parameters
dim cnn as adodb.connection
dim cmd as adodb.command
dim prm as adodb.parameter
dim rst as adodb.recordset
'set up the obejcts
set cnn = currentproject.connection
set cmd = new adodb.command
set rst = new adodb.recordset
'set the command to the connection and some properties
cmd.activeconnection = cnn
cmd.commandtext = "<your SQL proc name or a sql statement>"
cmd.commandtype = adcmdstoredproc
'repeat this for each parameter --
'return, inputs then output is the order from the sp!
set prm = cmd.createparmeter(fill in the stuff)
cmd.parameters.append prm
set rst = cmd.execute()
'now you have a command object with your result set, too