Solved

How to include Param in the SubReport SQL connection via VB?

Posted on 2007-03-25
4
241 Views
Last Modified: 2013-12-25
Hi,

I need to set a new data source for my Crystal Report Subreport. But, in the SQL string, it's something like this
SELECT * FROM tblRelationship WHERE ClientID = {?MainClientID}
Where {?MainClientID} is a param that pass value from the Main Report.

And during VB runtime, we need to change the database connection
    rs_main.Open strsql2, DB_CONN, adOpenStatic, adLockReadOnly
    rs_sub1.Open strSql, DB_CONN, adOpenStatic, adLockReadOnly        
       
    m_report.Subreport1.OpenSubreport.Database.SetDataSource rs_sub1

    m_report.Database.SetDataSource rs_main

So, now the problem come from, I can't directly set the SQL String to the mySQL as they will not accept {?MainClientID} . May I know how can I solve this?
0
Comment
Question by:cybeh
  • 2
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 18790744
Use the SELECT EXPERT under REPORT menu.

Set the FILTER or WHERE clause there.  Then you don't have to pass it to the report.

mlmcc
0
 
LVL 1

Author Comment

by:cybeh
ID: 18790753
But, I can point the WHERE to a Parameter rite? If this is not true, may I know how?
As I see I only have the option of "is equal to" or something like that.

0
 
LVL 1

Author Comment

by:cybeh
ID: 18790757
Found the solution, Thanks.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18794380
Glad i could help

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now