Dominator22m
Programmer
Hi there,
Please can someone help.. I have been pulling my hair out over this for about a week now.
I have a project with a report, the user can select a vehicle to view in the report and only records for that vehicle should be displayed, but all the records are being displayed. I have created a recordset and tried passing this to the report but it just wont have it Below is a snippet of my code :- (I have hard code the vehicle in for testing purposes)
Dim Report As New CrystalReport2
Dim ConHistory As Connection
Dim RsHistory As ADODB.Recordset
Set ConHistory = New Connection
With ConHistory
.Provider = "microsoft.jet.oledb.3.51"
.ConnectionString = "Data source = " & App.path & "\history.mdb"
.Open
End With
Set RsHistory = New ADODB.Recordset
With RsHistory
.Open "SELECT * FROM history WHERE [vehicle name] = " & Chr(34) & "T560 CFM" & Chr(34), ConHistory, adOpenStatic
End With
Report.Database.Tables(1).Location = App.path & "\history.mdb"
Report.Database.SetDataSource RsHistory, 3, 1
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Any help or guidance anyone could offer on this subject would be greatly appreciated.
Thanks In Advance
Brian
Please can someone help.. I have been pulling my hair out over this for about a week now.
I have a project with a report, the user can select a vehicle to view in the report and only records for that vehicle should be displayed, but all the records are being displayed. I have created a recordset and tried passing this to the report but it just wont have it Below is a snippet of my code :- (I have hard code the vehicle in for testing purposes)
Dim Report As New CrystalReport2
Dim ConHistory As Connection
Dim RsHistory As ADODB.Recordset
Set ConHistory = New Connection
With ConHistory
.Provider = "microsoft.jet.oledb.3.51"
.ConnectionString = "Data source = " & App.path & "\history.mdb"
.Open
End With
Set RsHistory = New ADODB.Recordset
With RsHistory
.Open "SELECT * FROM history WHERE [vehicle name] = " & Chr(34) & "T560 CFM" & Chr(34), ConHistory, adOpenStatic
End With
Report.Database.Tables(1).Location = App.path & "\history.mdb"
Report.Database.SetDataSource RsHistory, 3, 1
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Any help or guidance anyone could offer on this subject would be greatly appreciated.
Thanks In Advance
Brian