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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
You need to change the passthrough query by code.

I'm using template passthrough queries with placeholders, e.g.

DECLARE @Param INT = CAST('@Param1' AS INT);
EXECUTE p_sproc @Param;

Open in new window

While the CAST is not necessary, this approach means that even the passthrough is correct T-SQL. After copying the passthrough query, use REPLACE() to insert your parameter value.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peterslove53Author Commented:
So how do i accomplish my task?
ste5anSenior DeveloperCommented:
Programming, maybe?
peterslove53Author Commented:
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
peterslove53Author Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.