on 07-16-2009 4:11 PM
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
Are the data structures identical?
Did you try Database, Verify Database... (in Crystal Designer for that report)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same as the other post - locking this one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.