Link to home
Start Free TrialLog in
Avatar of cybeh
cybeh

asked on

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

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?
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

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 cybeh
cybeh

ASKER

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.

Avatar of cybeh

ASKER

Found the solution, Thanks.
Glad i could help

mlmcc