Hi all

I am using VB 6.0, MS Access as backend and Crystal Reports 10 for reports.
I connect data source to Crystal Reports 10 using ODBC dsn. It works correctly in my PC. When it is distributed to another PC, where the db path is different from my PC; reports is not working.

How can I set the data source location through coding?

I am using the following code, but it shows the error "script out of range".

Dim CrxApp As New CRAXDRT.Application
Public crxRpt As CRAXDRT.Report
Dim crxDatabaseTable As CRAXDRT.DatabaseTable

Private Sub Form_Load()
Dim DBTable As CRAXDRT.DatabaseTable
If MDIForm1.strReportName = "Address Label" Then
Set crxRpt = CrxApp.OpenReport(App.Path & "\Reports\studentmaillist.rpt")
For Each crxDatabaseTable In crxRpt.Database.Tables
crxDatabaseTable.ConnectionProperties("DSN") = sName
Next crxDatabaseTable
strClass = frmClassSelect.cboClass.Text
crxRpt.Database.Tables(1).Location = "tblStudentInfo"
crxRpt.Database.Tables(2).Location = "tblSchoolInfo"
crxRpt.RecordSelectionFormula = "{tblStudentInfo.ClassName} like '" & (strClass) & "'"
CRViewer1.ReportSource = crxRpt
End If

CRViewer1.EnableExportButton = True
CRViewer1.EnableNavigationControls = True
CRViewer1.EnableAnimationCtrl = True
CRViewer1.EnablePrintButton = True
CRViewer1.Zoom 100
CRViewer1.ViewReport
End Sub