cancel
Showing results for 
Search instead for 
Did you mean: 

CR9: Data retrieving

Former Member
0 Kudos

Greetings.

My name is Alias.

I have some issue. For the background, I am using VB6 and created reports using CR9. The database is mdb.

The problem is once I click a button to retrieve the report(invoicing), only the format is appeared without the data, eventhough the data is inside mdb. Then I click Refresh button many times..finally the data is appeared.

I am not very sure what to do. Please help me.

<<This is the coding that I use>>

Private Sub Form_Load()

On Error GoTo ErrorHandler

Dim conn As ADODB.Connection 'CONNECTION TO BROKER QUERIES

Dim rs As ADODB.Recordset 'HOLDS ALL DATA RETURNED FROM QUERY

Dim crystal As CRAXDRT.Application 'LOADS REPORT FROM FILE

Dim Report As CRAXDRT.Report 'HOLDS REPORT

CRView.DisplayBorder = False 'MAKES REPORT FILL ENTIRE FORM

CRView.DisplayTabs = False 'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED

CRView.EnableDrillDown = False 'REPORT DOES NOT SUPPORT DRILL-DOWN

CRView.EnableRefreshButton = True

Set conn = New ADODB.Connection

conn.CursorLocation = adUseClient 'SERVER-SIDE NOT RECCOMENDED

Set conn = GetConnection(0) ' set connection to the connection module

Set crystal = New CRAXDRT.Application 'MANAGES REPORTS

If frmInvoice.StatusBar.Panels(1).Text = "invepj_noremarks_gross" Then

Set Report = crystal.OpenReport("c:\epjlist\cr9\invepj_noremarks_gross.rpt")

frmsqlrpt.Caption = "Invoice('No' Remarks 'Yes' Gross)"

ElseIf frmInvoice.StatusBar.Panels(1).Text = "invepj_remarks_nogross" Then

Set Report = crystal.OpenReport("c:\epjlist\cr9\invepj_remarks_nogross.rpt")

frmsqlrpt.Caption = "Invoice('No' Gross 'Yes' Remarks)"

ElseIf frmInvoice.StatusBar.Panels(1).Text = "invepj_remarks" Then

Set Report = crystal.OpenReport("c:\epjlist\cr9\invepj_remarks.rpt")

frmsqlrpt.Caption = "Invoice('Yes' Gross 'Yes' Remarks)"

ElseIf frmInvoice.StatusBar.Panels(1).Text = "invepj_nogross" Then

Set Report = crystal.OpenReport("c:\epjlist\cr9\invepj_nogross.rpt")

frmsqlrpt.Caption = "Invoice('No' Gross 'No' Remarks)"

Report.Database.SetDataSource rsData

Report.DiscardSavedData

End If

CRView.ReportSource = Report 'LINK VIEWER TO REPORT

CRView.ViewReport 'SHOW REPORT

Do While CRView.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE

DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE

Loop 'WHILE REPORT LOADS.

CRView.Zoom 100

Set Report = Nothing

Set crystal = Nothing

Set rsData = Nothing

Set connStock = Nothing

Exit Sub

ErrorHandler:

MsgBox Err.description, vbInformation, "EPJLIST"

End Sub

Best regards,

Alias

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

See if when you load the report before you set any viewer properties helps. E.g.; load ther report, then set the recordset, then set the viewer properties, view report.

Ludek

Former Member
0 Kudos

Hi there Ludek.

Thanks for your advise. I got an idea from there and it works!

Refer back to my coding in my previous question, I moved the CRView.ReportSource = Report and CRView.ViewReport and put it after CRView.Zoom 100

Best Regards,

Alias

Answers (0)