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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting 1 record for my report

Status
Not open for further replies.

Tckazz

Technical User
Feb 19, 2002
17
US
Hi.. Easy Question I hope..

I have a VB6 application that goes thru a MS Access Database and when is finds certain criteria I would like it to use a report which is really a letter with information that only pertains to the one record in the database. However the report is looking at all the records in the database when it prints.
I am using Crystal 8. I just want to select 1 record for the report. I have just started using the Crystal Control in VB6 but have been working with Crystal Reports for a little while now. Any help would be appreciated

Thanks in advance..
 
How are you opening the report? With a recordset?
When you get the recordset for the report, do you pass the id to it first so that the recordset only returns the one value?

Transcend
[gorgeous]
 
I guess I don't know how to pass the ID to the report?
Here is the part of the code that pulls up the report.


Set rs2 = db.OpenRecordset("Customers", dbOpenSnapshot)
rs2.MoveLast
recounter2 = rs2.RecordCount
rs2.MoveFirst

For custcounter = 1 To recounter2

If rs!custid = rs2!custid And rs2!custemail <> &quot;&quot; Then
sCustEmail = Trim(rs2!custemail)
List1.AddItem rs2!custid & &quot; &quot; & sCustEmail


CrystalReport1.DataFiles(0) = &quot;c:\manager.mdb&quot;
CrystalReport1.ReportFileName = &quot;c:\late1.let&quot;

CrystalReport1.PrintReport


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top