I am using VB & Access to create a program for a clinic. I want to create a Report.
The Report is - Toal quantity of each medicine received & Issued.
I have created the Table in design time & in runtime contents in the table are deleted and new details are stored .All records are getting updated in the table.
The problem is in Report last record is not getting printed.
The report alone when refreshed all records are printed.

Anybody Please Help

ADConn.Execute "Delete from Stock_Det"
Do While Recordset1.EOF = False
Recordset3.AddNew
Recordset3!iCode = recset1!ItemCode
Recordset2.Open "Select Sum(Qty)as TotQty from Rec_Det
where ICode='" &Recordset1! Icode & "'", ADConn, 2, 3
Recordset3!QtyIn = IIf(IsNull(Recordset2!TotQty), 0, Recordset2!TotQty)
Recordset3.Update
Recordset2.Close
Recordset1.MoveNext
Loop
CrystalReport1.Reset
CrystalReport1.ReportFileName = App.Path & "\StockReport.rpt"
CrystalReport1.WindowState = crptMaximized
CrystalReport1.WindowShowPrintSetupBtn = True
CrystalReport1.WindowShowPrintBtn = True
CrystalReport1.Action = 1

Just close the connection and open it after the report is refreshed


Recordset1.MoveNext
Loop
' HERE COME THE NEW CODE FROM ME............
ADConn.CLOSE: SET ADConn=NOTHING
DOEVENTS
'HERE CODE ENDS ....................

CrystalReport1.Reset
CrystalReport1.ReportFileName = App.Path & "\StockReport.rpt"
CrystalReport1.WindowState = crptMaximized
CrystalReport1.WindowShowPrintSetupBtn = True
CrystalReport1.WindowShowPrintBtn = True
CrystalReport1.Action = 1


' AGAIN OPEN THE CONNECTION IF YOU WANT
ADConn.OPEN ...........................

This article has been dead for over six months. Start a new discussion instead.