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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!! Passing Sql to Crystal Rep. Through VB6

Status
Not open for further replies.

nhoj

Technical User
Jun 27, 2002
4
0
0
PH
Can anyone help me bout Passing a SQL to CRW (VB6)PLssss.
 
Hi,
You can pass a SQL to CR using the Crystal Report Control available as a component in VB. Just include that in your project. It has a property called SQLQuery or something similar. Just assign it the query and open the report. Assuming it to be SQL, it would work like this:
Crystal1.SQLQuery= queryString

where Crystal1 is the name of the CR component that you are using.
 
Hi,
Continuing with my previous reply, you can use the following piece of code:

Crystal1.ReportTitle= "Title of Report - Its your choice"
Crystal1.Connect= cn 'Name of the active connection
Crystal1.ReportName='Location of the report including'
Crystal1.DiscardSavedData=1
Crystal1.Action=1
Crystal1.Reset

Hopes it works.
 
Sir/Ma'am
I've already done that but nothing happens
I made a program at VB6 an a report at Crystal report 4.6
i call my reports in vb6 in these format:

With CrystalReport1
.ReportFileName = "PAth And The RPT File"
.DiscardSavedData = True
.SqlQuerry="StringQuerry"
.Action = 1
End With

Is there something wrong with this.
Plsss. Somebody HELP I really need it.
 
I am working on something similar at the moment, But do it slightly differently :

With cr212 'The vb crystal object
.ReportFileName = strRptFile
.SQLQuery= " Select * from Whatever"
.Destination = crptToWindow
.PrintReport
End With


Basically... What report
What query
Where to? (To file, to window, to printer)
And Do it now

PrintReport returns a value. If you put a break on this it will show an error number if it fails that you can look up in CR Help to find out why.

Good luck

David
 
I am working on something similar at the moment, But do it slightly differently :

With cr212 'The vb crystal object
.ReportFileName = strRptFile
.SQLQuery= " Select * from Whatever"
.Destination = crptToWindow
.PrintReport
End With


Basically... What report
What query
Where to? (To file, to window, to printer)
And Do it now

PrintReport returns a value. If you put a break on this it will show an error number if it fails. You can look up the error number in CR Help to find out why.

Good luck

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top