Skip to Content
0
Former Member
Jul 16, 2009 at 03:11 PM

"This field name is not known", VB6, CRXI RDC

27 Views

Implementing RDC/designer in VB6 code.

The underlying DB is SQL SERVER 2005. I turned to the RDC / designer method because I couldn't figure out, in a way that worked, how to override the SQL Server db at run time on client machine. My reports continued to want to find the tables on my development platform, not the live data in production. I've been fighting this thing for 6 weeks. (Never had the problem with Access mdb's, but that's a moot point)

Any help / advice is appreciated!!

All is well with my reports containing 1 table, using the following code:

module

Public KReport As New CrystalReport2

command button

Set KReport = New CrystalReport2

KReport.DiscardSavedData ' (may not be necessary, the report does not have saved data)

KReport.Database.AddOLEDBSource Adodc1.ConnectionString, "Netlink_ProductMaster"

KReport.Database.SetDataSource Adodc1.Recordset, 3, 1

Load Form2

Form2.CRViewer1.ReportSource = KReport

Form2.CRViewer1.ViewReport

Form2.Show

However, in my report with multiple tables I get error "This field name is not known" but no indication as to which field is a problem. Here's my code: (Note - If I bypass the SetDataSource code the report displays fine. That won't work at user site)

module

Public LReport As New CrystalReport3

command button

Dim i%

Dim result&

Set LReport = New CrystalReport3

LReport.DiscardSavedData

For i% = 1 To LReport.Database.Tables.Count

LReport.Database.AddOLEDBSource Adodc1.ConnectionString, LReport.Database.Tables(i%).Name

LReport.Database.SetDataSource Adodc1.Recordset, 3, i%

' LReport.Database.Tables(i%).CheckDifferences result&

' LReport.ReadRecords ' This just moved the error to here rather than when Form2 was "shown"

Next i%

Load Form2

Form2.CRViewer1.ReportSource = LReport

Form2.CRViewer1.ViewReport

Form2.Show