Link to home
Start Free TrialLog in
Avatar of peterslove53
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?
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peterslove53
peterslove53

ASKER

So how do i accomplish my task?
Programming, maybe?
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.QueryDefs("Passthrough_Proc").SQL = "EXEC MyStored_Proc Param1,Param2,param3"

where the parameter values can be changed to anything you want
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