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

creating a report to show multiple invoices

Status
Not open for further replies.

dueced

Programmer
Sep 6, 2002
1
US
Hi

Im kind of new with Crystal Reports and Im trying to create a report that will generate multiple invoice reports based on a job number that a user will input, but with my code Im only getting the last invoice report to print in the recordset that I want to show the multiple invoices for. Here is the code that I have so far.

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
Call Connect
CRViewer1.ReportSource = Report

Dim adoConn As ADODB.Connection
Dim rsInvoiceReports As ADODB.Recordset
Set adoConn = CreateObject("ADODB.Connection")
Set rsInvoiceReports = CreateObject("ADODB.Recordset")
adoConn.Open DSNAbsToolsInvoicing, DSNAbsToolsInvoicingUsername, DSNAbsToolsInvoicingPassword
SQL = "Select InvoiceId from tblInvoice Inner Join tbljob on tbljob.jobid = tblinvoice.fjobid "
SQL = SQL & " where Job_No = " & IntInvoiceReportJobId
SQL = SQL & " and tblJob.activeflag = 1 and tblInvoice.activeflag = 1"
rsInvoiceReports.Open SQL, adoConn, adOpenStatic

Dim InvoiceCount As Integer
InvoiceCount = 1
Do Until rsInvoiceReports.EOF
Report.ParameterFields(InvoiceCount).AddCurrentValue (CInt(rsInvoiceReports("InvoiceId")))
InvoiceCount = InvoiceCount + 1
rsInvoiceReports.MoveNext
Loop



CRViewer1.ViewReport
Screen.MousePointer = vbDefault
Me.WindowState = 2





 
Hmmm...

Try creating a Control Array for the Crystal Viewer control? Then ".load" one for each invoice in your Do..Loop.

Put the ".viewReport" in this loop too. This will bring up a window for each invoice.

Not sure that helps you! Haven't dealt with such things for a while!

Let me know! Bobbber.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top