Solved

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

Posted on 2007-03-25
4
226 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

23 Experts available now in Live!

Get 1:1 Help Now