ey i have following code for crystal report 8.5 to vb6...
i just want to change database location of report from vb code...

    Private Sub Form_Load()
        Dim Reportapp As New CRAXDDRT.Application
        Dim Report As CRAXDDRT.Report
        Set Report = Reportapp.OpenReport(App.Path & "\orders.rpt")
        Report.Database.SetDataSource App.Path & "\RatanDB.mdb"
        CRViewer2.ReportSource = Report
        CRViewer2.ViewReport
        CRViewer2.Zoom (100)
    End Sub

the setdatasource is not working, its going in it's default location...
i want it to search in -->> App.path & "\RatanDB.mdb"
can any one help me, its urgent please tank you... :)

Recommended Answers

All 3 Replies

This is what Im using on my crystal report 8.5.

Reports are created and connected via odbc so database location can be easily change.

Dim crxTable As CRAXDRT.DatabaseTable
Dim mReport As CRAXDRT.Report

For Each crxTable In mReport.Database.Tables

 '* Use to Connect via ODBC,
 '* crxTable.SetLogOnInfo(pServerName As String, [pDatabaseName], [pUserID], [pPassword])

 crxTable.SetLogOnInfo "ODBCName", "db.mdb", "admin", "passwordgoeshere"
 DoEvents
Next

thank you buddy thank you very much, sooooooo much...... i got it...

My pleasure to help you. Please mark the thread as SOLVED.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.