try the following code
Public Sub DailyReportDisplay(Query As String)
Set CRXReport = CrystalReport2
Set CRXDb = CRXReport.Database
CRXReport.DiscardSavedData
inti = 1
Do Until inti = CRXReport.Database.Tables.count + 1
CRXReport.Database.Tables.Item(inti).SetLogOnInfo strdblocation, "das", "debasis", "debasis"
inti = inti + 1
Loop
CrystalReport2.SQLQueryString = Query
With FrmReport
.Show
.CRV1.ReportSource = CRXReport
.CRV1.ViewReport
End With
Set CRXReport = Nothing
End Sub
the above code uses crystal report viewer.
u need to add crystal report library and a crystal report viewer.
The above is for Oracle connection.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434