hallianonline 0 Newbie Poster

Hello Every One, I am new to VB6 and I am getting the problem from few days.
I want to print a label sheet of the specific barcode which contains(description, barcode image and unit price), as much times I want the label should repeat on the same sheet to that number of times in row wise as shown in the image attached below
here is my code plz help me as soon as possible I'll be really thankful.

Option Explicit
Private Sub btnprnt_Click()
Dim qty As Integer
Dim A As Integer
Dim numcopies 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"
            Exit Sub
        End If

        Set ac = New ADODB.Connection
        Set ar = New ADODB.Recordset

        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

      End With

            MsgBox "Barcode not found", vbInformation, "Record not found"
        End If
        MsgBox "No product exist in database", vbInformation, "Record not found"
    End If
    End With
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.