I want to print the multiple copies of data report as shown in the attached picture, its printing only printing only one.
I have created the text box in the form to provide the number of copies named as txtcopies. plz check and resolve
Here is the full coding of that form
Option Explicit
Private Sub btnprnt_Click()
Dim qty As Integer
Dim A As Integer
qty = txtcopies.Text
On Error Resume Next
'Check if the barcode field is blank
If txtbarcodes.Text = "" Then
MsgBox "Please enter the barcode", vbInformation, "Barcode Error"
txtbarcodes.SetFocus
Exit Sub
End If
Set ac = New ADODB.Connection
Set ar = New ADODB.Recordset
Call openDB
ac.Open strConek
With ar
SQL = "Select *From tblproduct Where Barcode='" & txtbarcodes.Text & "'"
.Open SQL, strConek, adOpenStatic, adLockOptimistic
If .RecordCount >= 1 Then
If !Barcode = txtbarcodes.Text Then
SQL = "Select *From tblproduct where Barcode= '" & txtbarcodes.Text & "'"
DE.rsproduct.Open SQL
With printbarcode
.Sections("Section1").Controls.Item("txtDescription").Caption = !Description
.Sections("Section1").Controls.Item("txtUnitPrice").Caption = !UnitPrice
Set .Sections("Section1").Controls.Item("Image1").Picture = LoadPicture(App.Path & "\Barcodes\" & txtbarcodes & ".jpg")
For A = 1 To qty
Call printbarcode.PrintReport(False, rptRangeAllPages)
Next A
DE.rsproduct.Close
End With
Else
MsgBox "Barcode not found", vbInformation, "Record not found"
End If
Else
MsgBox "No product exist in database", vbInformation, "Record not found"
End If
.Close
End With
End Sub

New Topic/Question
Reply



MultiQuote




|