CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    May 2012
    Posts
    2

    Data Report urgent help

    Hello
    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
    Code:
    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
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured