Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21301

subscript out of range run time error '9' vb6 crystal report

$
0
0
I am getting this error when I try to pass an sql string to an external crystal report. extenal in the the report is not part of the project but a crystal report file. I have uploaded a summarised version of the project

Code:


Dim Report As New CrystalReport1

Set rs = New ADODB.Recordset
Dim strSql As String

Dim ReportStartDate As Date
Dim ReportEndDate As Date

ReportStartDate = txtStartDate.Text
ReportEndDate = txtEndDate.Text

strSql = "SELECT * from Outwards WHERE date >= #" & ReportStartDate & "#  And date <= #" & ReportEndDate & "# and ShiftNumber >= " & txtStartShift.Text & " And ShiftNumber <= " & txtEndShift.Text & ""
'rs.Open strSql, Con
rs.Open strSql, Con, adOpenKeyset, adLockOptimistic, adCmdText


Report.DiscardSavedData
Report.Database.Tables(1).SetDataSource rs, 3'>>> Where the error shows up

CRViewer1.ReportSource = Report.Application.OpenReport("C:\CrystalSample\NOPS36.rpt")

CRViewer1.Refresh
CRViewer1.ViewReport

Set Report = Nothing
Set rs = Nothing

Attached Files

Viewing all articles
Browse latest Browse all 21301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>