Solved

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

Posted on 2007-03-25
4
272 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Null as value for Dynamic parameter in CR2008? 9 58
Crystal Reports 12 46
Collapse and expand table in Word 2010 2 97
Assign a value in Excel V-Basic 3 29
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
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…
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…
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…

756 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