4 Replies - 1534 Views - Last Post: 29 May 2012 - 03:22 AM Rate Topic: -----

#1 hassanzobeen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-May 12

Data Report urgent help

Posted 28 May 2012 - 03:56 AM

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
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 image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Data Report urgent help

#2 leixnt  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 24-July 11

Re: Data Report urgent help

Posted 28 May 2012 - 08:10 PM

the best way to create vertical report copies like you want is

1. create temporary table contain (i assume 6 data like your picture)
2. then create recordset to take all data from temporary table to data report.

hope you solve it
Was This Post Helpful? 0
  • +
  • -

#3 hassanzobeen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-May 12

Re: Data Report urgent help

Posted 29 May 2012 - 02:53 AM

Can you please help me in detail because I am new to vb6
Was This Post Helpful? 0
  • +
  • -

#4 leixnt  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 24-July 11

Re: Data Report urgent help

Posted 29 May 2012 - 03:07 AM

i'll help you with an illustration

your data is
Cake
0000000000468
Rs. 250


you want to create 6 record from that to report right ?
then

open recordset to insert 6 record with same data to temporary table (ex: tmpTable)
so, data on tmpTable was 6 record now

then use recordset again to retrieve it from table to print to report
Dim recordset As New ADODB.Recordset
recordset.Open "select * from tmpTable",connection

Do Until recordset.EOF
   'data report print section
   recordset.Movenext
Loop


This post has been edited by leixnt: 29 May 2012 - 03:10 AM

Was This Post Helpful? 0
  • +
  • -

#5 hassanzobeen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-May 12

Re: Data Report urgent help

Posted 29 May 2012 - 03:22 AM

I am not understanding correctly that where I have to create tmptable in sql database?
if yes then what will be the fields of that table?
these are my form files and data report files with bar code plz check

Attached File(s)

  • Attached File  new.zip (66.98K)
    Number of downloads: 91

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1