Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

785 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