I am new to Crystal Report and having problem while generating Report in runtime.
I have create ttx file and using that to create report. Once, I am done with both I use vb application to pass the recordset to rport and then view and print..
I am getting blank report......
Here is the code.....
Any help will be appreciated...
Thanks allot...
Please mail to tathagat.dwivedi@gmacrfc.com if u can
----------------------------------
Private Sub Form_Load()
Dim conn As New ADODB.Connection 'CONNECTION TO BROKER QUERIES
Dim rs As New ADODB.Recordset
Dim appn As New CRAXDRT.Application
Dim rpt As New CRAXDRT.Report
CRViewer1.DisplayBorder = True '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
Do While CRViewer1.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE
DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE
Loop
Dim sConnectStr As String
Dim sid, user, passwd As String
sid = "shrd"
user = "tdwived"
passwd = "tdwived"
On Error GoTo ErrorHandler
sConnectStr = "Provider=MSDAORA;Data Source= " & sid & ";User ID=" & user & ";Password=" & passwd & ""
conn.CursorLocation = adUseClient
conn.CommandTimeout = 60
conn.Open sConnectStr
MsgBox "connected"
rs.Open "SELECT ASSET_SEQ_ID,ASSET_STATUS_CODE FROM ASSET WHERE rownum <=2", conn, adOpenStatic, adLockReadOnly
Set rpt = appn.OpenReport("C:\Project\Rms\Release\Feb-2004\Crystal Report\CrystalReportWithDdtFile.rpt"

MsgBox rs.Fields(1).Value
rpt.Database.Tables.Item(1).SetLogOnInfo "SHRD.RFC.COM", "", "TDWIVED", "TDWIVED"
'rpt.Database.Tables(1).SetLogOnInfo "", "shrd", "tdwived", "tdwived"
'rpt.DiscardSavedData
rpt.Database.SetDataSource rs, 3, 1
CRViewer1.ReportSource = rpt
CRViewer1.ViewReport
Do While CRViewer1.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE
DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE
Loop 'WHILE REPORT LOADS.
CRViewer1.Zoom (100)
'CRViewer1.PrintReport
'CRViewer1.Visible = True
rs.Close 'ALL BELOW HERE IS CLEANUP
Set rs = Nothing
conn.Close
Set conn = Nothing
' -----------
Exit Sub
ErrorHandler:
MsgBox (Err.Number & ":" & Err.Description)
End Sub