How to set input parameters for report?

Report uses query that contains input parameters.
When I opens report I dont want to enter it.
How can I set it programmatically?I use VC++.
I opens report by :
Can I put it in SQL query as third argument(condition)?And how I must modify this query?
SQL query:
SELECT qryStatements.DivisionCode, qryStatements.DivName, qryStatements.StatementID, qryStatements.StatementCycleYear, qryStatements.StatementCycleMonth, qryStatements.UserTrustID, qryStatements.FoundationName, qryStatements.TrustName, qryStatements.StatementFromDate, qryStatements.StatementToDate, qryStatements.StatementBegBalance, qryStatements.StatementEndBalance, qryStatements.TotalContribution, qryStatements.TotalDistribution, qryStatements.EarningsToDonor, qryStatements.EarningsToGenFund, qryStatements.ChgMktValue, Foundation.pic, qryStatements.Expr1, qryStatements.Rep_Type, qryStatements.DonorName, qryStatements.Donorcsz, qryStatements.DonorAddr1, qryStatements.DonorAddr2, qryStatements.OrgName, qryStatements.DivAddr1, qryStatements.DivAddr2, qryStatements.DivCity, qryStatements.DivState, qryStatements.DivZip, qryStatements.WorkPhone, Foundation.small_logo, qryStatements.web_site, Foundation.StatementFooter
FROM qryStatements INNER JOIN Foundation ON qryStatements.DivisionCode = Foundation.DivisionCode
WHERE qryStatements.StatementCycleYear=[Statement Year] AND qryStatements.StatementCycleMonth=[Statement Month] AND qryStatements.UserTrustID>=[From FundID] And qryStatements.UserTrustID<=[To FundID] AND qryStatements.Rep_Type="Stmnt"
ORDER BY qryStatements.DivisionCode;
Who is Participating?
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.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
1. You can point the parameters to a in memory variable with a function call.  ie.

Public Sub SetParam(ByVal InputVal, ByVal ParamID)

    arrParameter(ParamID) = InputVal

End Sub

 before opening the report then redefine the query to do


Public Function GetParam(ByVal ParamID)

    GetParam = arrParameter(ParamID)

End Function

2. You can use a hidden form with controls, populate the controls, then have the select statement reference the form controls


3. You can modify the SQL statement on the fly in the reports Open event and supply the actual values to the string.


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
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to JDettman
Please leave any comments here within the next seven days.
EE Cleanup Volunteer
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 Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.