Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal is losing tables when I change the DB Location Dynamically

Status
Not open for further replies.

jmreynolds

Programmer
Jul 7, 2011
4
US
My coworker and I have been trying to work with a Crystal 9 Report in VBA \ VB6. We need to set the database location programmatically.

We are using the following code:

Code:
For Each oSection In oSections
    For Each oRptObj In oSection.ReportObjects
        If oRptObj.Kind = crSubreportObject Then
            Set oSubReportObject = oRptObj
            Set oSubReport = oSubReportObject.OpenSubreport
            For Each tbl In oSubReport.Database.Tables
                tbl.Location = mdbPath
            Next
            Set oSubReport = Nothing
        End If
    Next
Next

For Each tbl In oRpt.Database.Tables
    tbl.Location = mdbPath
Next
but instead of setting the location, it is deleting all of the tables, such that oRpt.Database.Tables is empty.

Any ideas what is going on here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top