Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a recordset to crystal reports 8.5 (Urgent) 1

Status
Not open for further replies.

Dominator22m

Programmer
Oct 15, 2003
10
0
0
GB
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



Bad spellers of the world untie!!!
 
Hi pgtek,

Thank you very much..This has worked, although i had to change the way i made the reports because they wernt using ttx files, but it is now working which is the main thing.

Again Thank You

Brian


Bad spellers of the world untie!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top