[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4952
  • Last Modified:

Printing Barcodes from Vb6.0

Hi Experts!

Have designed an application in Vb6.0 and Access 2000 as backened... In the application I have an option to print barcodes... I want to generate barcodes depending on the number of qty entered by the user to print the barcode labels... Now the problem faced my me is that when the Qty entered is 1 the barcode prints 1 label properly, when Qty = 2 is two barcode labels get printed, but when qty entered is 10 only 3 barcode labels get printed... What is the reason for this??? Please help m pasting my code below which i use to generate and print barcode labels...

My code is as follows :

Private Sub cmdPrintBarcode_Click()
Dim i As Integer
Dim BQty As Integer
'Text2(2) -> GarmentCode
'Text2(8) -> UnitPrice
'Text2(9) -> Qty

If Not IsNull(Text2(2).Text) Or (Text2(2).Text) <> "" Then
    If IsNull(Text2(8).Text) Or (Text2(8).Text) = "" Then
        MsgBox "Please enter Unit Price", vbExclamation, "Unit Price"
    ElseIf IsNull(Text2(9).Text) Or (Text2(9).Text) = "" Then
        MsgBox "Please enter Qty Purchased", vbExclamation, "Qty Purchased"
        'Else generate barcode
        'BQty stores the Qty of Garments purchased...
        BQty = Text2(9).Text
        For i = 1 To BQty
            'Barcode generation and print code...
            Open "c:\abc.txt" For Output As #1
            Print #1, Chr(2) & "L"
            Print #1, "D11"
            Print #1, "H11"
            Print #1, "PC"
            Print #1, "SC"
            Print #1, "R0001"
            Print #1, "C0001"
            'Prints CompanyName
            Print #1, "191100100550013" & "ABCL"
            'Prints Amount next to CompanyName
            Print #1, "191100100550092" & "Rs." & Format(Me.Text2(8).Text, "##,##0.00")
            'Prints GarmentCode- GarmentCategory - Size
            Print #1, "191100100450012" & Me.Text2(2).Text & " - " & Me.Combo1(2).Text & " - Size " & Me.Text2(5).Text
            'Prints Description
            Print #1, "191100100350012" & Me.Text2(6).Text
            'Prints Barcode (e - only barcode is printed)
            Print #1, "1e2202100100012" & Me.Text2(2).Text  'will print barcode..
            '9 Human readable
            'E - Barcode with number is printed
            'small e - only barcode is printed
            'column position 10
            Print #1, "Q0001"
            Print #1, "E"
            Close #1
            Shell "c:\abc.bat", vbMinimizedFocus
        Next i
    End If
End If
End Sub


Any help would be appreciated...

Thank you
1 Solution
Hi twinkle2003,

Can you not simply do away with the loop and set the quantity in the line : Print #1,"Q0001", make this

Print #1,"Q" & Format(BQty,"0000")

This looks similar to Sato or Zebra printer coding so the Qxxxx is the number of labels to print.

Tim Cottee
twinkle2003Author Commented:
Hi Tim!!

That was a excellent solution... Thank you...

Shaukat aliCommented:

Can u pls explain me how u r using the barcode reading and, also type of barcode, need to implement in my project. thanks , in vb6 - access

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now