Report Appears Blank despite Query containing records
Posted on 2006-11-29
I have imported a Crystal Report into a VB6 Project and set the Reports Datasource as follows:
Dim Report as New ControlsReport
Dim ADOrs as New ADODB.Recordset
Private Sub Form_Load( )
Dim ADOrs as New ADODB.RecordSet
Dim sql as String
'sql = "Select * from qryTallyReport3;"
sql = "Select * from qryControlsScanned;"
ADOrs.Open sql, cn, adOpenDynamic, adLockPessimistic, adCmdText
Report.Database.SetDataSource ADOrs, 3, 1
CRViewr1.ReportSource = Report
Now, the records show up if I switch the sql lines (commenting out the lower and using the upper). These queries, however, contain identical fields and the only difference is qryControlsScanned is built off of qryTallyReport3, but uses a "Like" statement to limit the results. If I open the query from within the Access database, it contains a record. Also, when I open the Report from within Crystal Reports, the records show up.
The only problem I have is when I use the code as it appears, when the report is opened with the code, the Report is blank and "ADOrs" is empty.......
Anyone have an idea?