[Resolved] VB .Net 2003 Crystal Reports 10 question
Anyone know why the following code is giving me an error?
VB Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO
Dim crpt As New ReportDocument
crpt.Load("C:\VB.Net Programs\Fuel Report\FuelRpt.rpt")
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
With myLogin.ConnectionInfo
.ServerName = "202.101.8.107"
.UserID = "sa"
.Password = ""
.DatabaseName = "Daily"
End With
myTable.ApplyLogOnInfo(myLogin)
Next
crpt.RecordSelectionFormula = "{DailyFuelView.DateSold} = Date (" & strDate & ")"
CrystalReportViewer1.ReportSource = crpt
crpt.DataDefinition.FormulaFields.Item("Text5").Text = Format(dblFuel, "#,00.00")
I'm getting an error on the very last statement. Everything else works fine.
The error message is: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in crystaldecisions.crystalreports.engine.dll
Additional information: Invalid index.
Thanks