Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing SQL query from VB to Crystal 7

Status
Not open for further replies.

Huffdad76

Programmer
Feb 14, 2001
3
US
Hi!

I am developing a Visual Basic 6 front-end application that queries the user to choose from a series of drop-down boxes to specify various selection criteria. Behind the scenes, based on the selection the user has made, an SQL query will be built.

The user would then be prompted to choose from a list of available production report templates (*.rpt files created in Crystal 7). Once the user selects their report and hits the "Submit" button, I would like to be able to pass the SQL query that the user generated to the selected Crystal report template, using that query to provide the data for the report.

I am using Crystal Reports 7 ActiveX control and my code is basically this:

CrystalReport1.ReportSource = crptReport
CrystalReport1.ReportFileName = reportpath
CrystalReport1.SQLQuery = strSQLQuery
CrystalReport1.WindowState = crptMaximized
CrystalReport1.UserName = UserName
CrystalReport1.Connect = LoginInfo
CrystalReport1.Action = 1

Fairly straight forward, however the .SQLQuery property does not seem to be overriding the SQL stored in the *.rpt template as its supposed to.

Is there any way to accomplish this task? Am I going about this the wrong way?

Any help would be appreciated.

Thanks!

- Mike Huffman
michael.huffman@kmhp.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top