passing parameter to stored procedure

J

Jeroen

What I'm trying to achieve is having a tabular sheet for editing purposes
where a subset of the dataset is selected by a dropdownlist.

The data section is based on a tabular view, a stored procedure
sp_INP_Adjusment. So the dataset that is being retrieved is depending on the
parameter set. The stored procedure is defined as:

ALTER PROCEDURE sp_INP_Adjustment @pCompanyID varchar(10) AS

SELECT *
FROM INP_Actual_Adjustment
WHERE CompanyID = @pCompanyID

A separate dropdownlist ("DropdownList1") has been defined which is
connected to a view with companies to select. When a change occurs, it
executes the following script:

<SCRIPT language=vbscript event=onchange for=DropdownList1>

MSODSC.RecordsetDefs("sp_INP_Adjustment").parametervalues.Add "@pCompanyID",
RTrim(DropdownList1.value)

If have also tried many other commands, like:

- EXEC sp_INP_Adjustment RTrim(DropdownList1.value)
- DoCmd.OpenStoredProcedure "sp_INP_Adjustment", "Datasheet", "Edit"
- msodsc.recordsetdefs(0).parametervalues.Add "@pCompanyID",
RTrim(DropdownList1.value)
- MSODSC.GetContainingSection("HeaderspINPAdjustment").DataPage.Requery

None of them works properly. I have also put a statement MsgBox(), but not
always the message is shown. Does anybody know what I'm doing wrong? I have
spend quite a lot of time already and I can't figure it out myself. Maybe the
approach is totally wrong? Please let me know.

Regards,
Jeroen
 
R

Rock Hill Phil

Did you ever get resolution on this issue? I have a very similar question.
 
T

Tim Ferguson

"=?Utf-8?B?Um9jayBIaWxsIFBoaWw=?=" <Rock Hill
(e-mail address removed)> wrote in
Did you ever get resolution on this issue? I have a very similar
question.

I don't recognise the libary being used here. The equivalent in ADODB is
the Command object, for which you can create the appropriate Parameters
objects.

HTH


Tim F
 

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