?
Solved

How to set input parameters for report?

Posted on 2003-02-27
3
Medium Priority
?
197 Views
Last Modified: 2012-06-27
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 :
m_pDoCmd->OpenReport(COleVariant("Statements"),0,COleVariant(""),COleVariant("UserTrustID="+strIdPath+""));
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;
Thanks.
0
Comment
Question by:MByte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 400 total points
ID: 8033994
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

   GetParam(1)

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

  Forms![myformName]![mycontrolName]


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

Jim.
0
 
LVL 18

Expert Comment

by:1William
ID: 8772065
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.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
1William
EE Cleanup Volunteer
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question