peterslove53
asked on
Combobox used to Pass Parameter to Passthrough Stored Procedure in Access Form
i have a passthrough stored procedure in access from SQL Server which is saved and used to create a form. it accepts atleast one parameter;
MyStoredProc 432, ' ',' '
where 432 is a unique ID
But on my form, i want to be able to filter the record based on which ever ID i pick on a combo box on the form header. so if i pick ID = 150,
i want my form to display the output of the procedure for ID = 150
so the record will be the result of
MyStoredProc 150, ' ',' '
by default; the form displays the result of: MyStoredProc 432, ' ',' '
but from the drop down combobox, we can filter the result based on whichever ID is picked. How do i accomplish this?
MyStoredProc 432, ' ',' '
where 432 is a unique ID
But on my form, i want to be able to filter the record based on which ever ID i pick on a combo box on the form header. so if i pick ID = 150,
i want my form to display the output of the procedure for ID = 150
so the record will be the result of
MyStoredProc 150, ' ',' '
by default; the form displays the result of: MyStoredProc 432, ' ',' '
but from the drop down combobox, we can filter the result based on whichever ID is picked. How do i accomplish this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Programming, maybe?
ASKER
I got it. Create a passthrough query (Stored procedure) save it just like you would a normal query (Passthrough_Proc)and use that to create the form, just like a normal query. then at runtime we can pass our parameter by editing our query like this; put following code under click event to open form
Application.CurrentDb.Quer yDefs("Passthrough_Proc").SQL = "EXEC MyStored_Proc Param1,Param2,param3"
where the parameter values can be changed to anything you want
Application.CurrentDb.Quer
where the parameter values can be changed to anything you want
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for peterslove53's comment #a40826480
for the following reason:
correct solution
Accepted answer: 0 points for peterslove53's comment #a40826480
for the following reason:
correct solution
ASKER