borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (component or reference)Next Topic (help me) New Topic New Poll Post Reply
AndreaVB Forum : Reporting tools : Doubt with CR
Poster Message
Ramya
Level: Sage

Registered: 08-04-2005
Posts: 60

icon Doubt with CR

Hai
I am using CR8.2 along with my vb project.
I need to do two things.
I need to save the crystal report output file to PDF at runtime.
I need to supply the filename for that PDF at the time of report generation from VB itself.

08-06-2005 at 10:59 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Doubt with CR

I use CR 9.2 (and I assume you also, and you made a typing mistake with 8.2). Look at the

Export and ExportProperties of CRAXDRT.Report object.

____________________________
If you find the answer helpful, please mark this topic as solved.

08-06-2005 at 02:08 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ramya
Level: Sage

Registered: 08-04-2005
Posts: 60
icon Re: Doubt with CR

Hai
Can u please explain it mroe briefly.I am using 8 version.Can u give me teh code to do it  

09-06-2005 at 11:32 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Doubt with CR

With rpt.ExportOptions
    .FormatType = crEFTPortableDocFormat
    .DestinationType = crEDTDiskFile
    .DiskFileName = "c:\test.pdf"
End With

rpt.Export False


where rpt is CRAXDRT.Report object.

____________________________
If you find the answer helpful, please mark this topic as solved.

09-06-2005 at 05:40 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ramya
Level: Sage

Registered: 08-04-2005
Posts: 60
icon Re: Doubt with CR

Hai Goran
Thanks for ur continous help.But u see I have some problem with my report now.Heres my code to display report
Private Sub Form_Load()
'Dim crystal As CRAXDDRT.Application
'dim crystal as cr

Dim report As CRAXDRT.report
CRViewer1.DisplayBorder = False          'MAKES REPORT FILL ENTIRE FORM
CRViewer1.DisplayTabs = False            'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
CRViewer1.EnableDrillDown = False        'REPORT DOES NOT SUPPORT DRILL-DOWN
CRViewer1.EnableRefreshButton = False    'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED
Dim rs As New ADODB.Recordset
rs.Open "select * from dailystmt", con, adOpenStatic, adLockOptimistic
Set crystal1 = New CRAXDRT.Application
    Set report = crystal1.OpenReport(App.Path & "\Daily Statement.rpt")  'OPEN OUR REPORT
    report.DiscardSavedData
    'Report.DiscardSavedData                      'CLEARS REPORT SO WE WORK FROM RECORDSET
    report.Database.SetDataSource rs             'LINK REPORT TO RECORDSET
'    CRViewer1.Refresh

    CRViewer1.ReportSource = report              'LINK VIEWER TO REPORT
    
'    Do While CRViewer91.IsBusy            'ZOOM METHOD DOES NOT WORK WHILE
'        DoEvents                          'REPORT IS LOADING, SO WE MUST PAUSE
'    Loop                                  'WHILE REPORT LOADS.
'

'    rs.Close                            'ALL BELOW HERE IS CLEANUP
'   Set rs = Nothing


And when i execute thsi An empty REport(fully Blank and clear in white color) is displying .What might be my rpoblem.

10-06-2005 at 08:23 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Doubt with CR

CRViewer1.ReportSource = rpt
CRViewer1.ViewReport


____________________________
If you find the answer helpful, please mark this topic as solved.

10-06-2005 at 07:07 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ramya
Level: Sage

Registered: 08-04-2005
Posts: 60
icon Re: Doubt with CR

Goran
Heres my new code.
Private Sub Form_Load()

Dim rs As New ADODB.Recordset
Dim report As CRAXDRT.report
CRViewer1.DisplayBorder = False          'MAKES REPORT FILL ENTIRE FORM
CRViewer1.DisplayTabs = False            'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
CRViewer1.EnableDrillDown = False        'REPORT DOES NOT SUPPORT DRILL-DOWN
CRViewer1.EnableRefreshButton = False    'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED

rs.Open "select * from dailystmt", con, adOpenStatic, adLockOptimistic
MsgBox (con)

Set crystal1 = New CRAXDRT.Application
    Set report = crystal1.OpenReport("c:\New PMS\Daily Statement.rpt")  'OPEN OUR REPORT
    report.DiscardSavedData
    'Report.DiscardSavedData                      'CLEARS REPORT SO WE WORK FROM RECORDSET
    report.Database.SetDataSource rs             'LINK REPORT TO RECORDSET
'    CRViewer1.Refresh
     CRViewer1.ReportSource = report
    CRViewer1.ViewReport
    CRViewer1.Refresh
                'LINK VIEWER TO REPORT
    
'    Do While CRViewer91.IsBusy            'ZOOM METHOD DOES NOT WORK WHILE
'        DoEvents                          'REPORT IS LOADING, SO WE MUST PAUSE
'    Loop                                  'WHILE REPORT LOADS.
'

'    rs.Close                            'ALL BELOW HERE IS CLEANUP
'   Set rs = Nothing

End Sub

Now the problem what i get here is when i execute the above one i get an error in the line crviewer1.refresh as"METHOD OF OBJECT FAILED"and when i debug it and press f5 again means it woprks perfectly.That is when i execute the Refresh command second tyime means its working perfectly.What might be my problem.Can u help me to sove it.Its little bit urgentl also.

11-06-2005 at 05:05 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Doubt with CR

Remove refresh method, you dont need it.

____________________________
If you find the answer helpful, please mark this topic as solved.

11-06-2005 at 04:09 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ramya
Level: Sage

Registered: 08-04-2005
Posts: 60
icon Re: Doubt with CR

Is it true then why do we need that refresh method in CR.Then can u tell me as how to export a file to PDF i.e how to export crreport topdf

13-06-2005 at 12:42 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Doubt with CR

refresh is used when data from database is changed, so you want to rerfresh report to load actual data, or when you have changed some report object through code, and you want to update this change to be visible on the screen. No need to refresh CR since you have just loaded report. The error you have received is because CR was still not loaded, but you have tried to refresh it.

As for the exporting to PDF, I have exlpained you how in above posts.

____________________________
If you find the answer helpful, please mark this topic as solved.

13-06-2005 at 08:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Reporting tools : Doubt with CR
Previous Topic (component or reference)Next Topic (help me) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder