# Print data from MS Table into a Label, using ZPL Code...



## Focus2 (Nov 30, 2011)

I have in program which print large label. I have design the label, but it will need to insert data from the Ms Access Table. I have two text box where I select the range of the data I require, but I need all the data I selected to show up on the label in order.

If anyone familar with this, please help if can.

Thanks,


Option Explicit On
Imports YF_Bulk_Load_Label_Program.ZebraLabels
Public Class Form1
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim _print As New ZebraPrint ' This whole process start off the printing process'
Dim AccessDR As OleDb.OleDbDataReader
Try
Dim AccessCommand As New OleDb.OleDbCommand
Dim AccessConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\Documents and Settings\Captain\My Documents\YF Lines.mdb;")
AccessCommand.CommandText = "SELECT * FROM [YF End of Line Data] WHERE [SEQ]= " & TextBox1.Text & ""
'"SELECT [Part Description] FROM [YF End of Line Data] WHERE [SEQ]>=" & TextBox1.Text & " and [SEQ]<=" & TextBox2.Text & " "
'"SELECT [Part Description] FROM [YF End of Line Data] WHERE [SEQ]>=" & TextBox1.Text & " and [SEQ]<=" & TextBox2.Text & " "
'"SELECT * FROM [YF End of Line Data] WHERE [SEQ]= " & TextBox1.Text & " "
AccessCommand.Connection = AccessConnection
AccessConnection.Open()
AccessDR = AccessCommand.ExecuteReader
While AccessDR.Read
_print.StartWrite("//10.53.252.59//YFTEST") 'Inorder to print from the printer, must input the following code'
_print.Write("^XA")
_print.Write("^SZ2^JMA")
_print.Write("^MCY^PMN")
_print.Write("^PW802~JSN")
_print.Write("^JZY")
_print.Write("^LH0,0^LRN")
_print.Write("^XZ")
_print.Write("^XA")
_print.Write("^FT240,50")
_print.Write("^CI0")
'_print.Write("^A0N,12,14^FDHMMA Rack ID:^FS")
_print.Write("^FT230,15") ''''FOR HMMA RACK IS.. SECOND NUM MOVES UP OR DOWN.... 
_print.Write("^A0N,14,16^FDHMMA Rack ID:^FS")
_print.Write("^FT230,75") '''''line feed
_print.Write("^A0N,14,16^FDLine Feed:^FS")
_print.Write("^FT230,95") 'THE pART # ON THE TOP 2ND NUMBER MOVE LEFT OR RIGHT
_print.Write("^A0N,24,22^FD" & ComboBox1.Text & "^FS") 'THE pART # ON THE TOP XIZE
_print.Write("^FT16,75")
_print.Write("^FT206,262") ' THIS for PHA BODY SYSTEM LOAD ID:
_print.Write("^FT16,20") ''Rack'
_print.Write("^A0N,17,19^FDPHA Body Systems^FS")
_print.Write("^FT16,100") ''Rack
_print.Write("^A0N,15,17^FDRack:^FS")
_print.Write("^FT562,1186")
_print.Write("^FS^FO225,0")
_print.Write("^GB0,117,2^FS") '' straight line, that increase or decrease line.
_print.Write("^FO0,115") ' LINE THAT MOVE BY LINE FEED.. NUMBER 2 MOVES UP OR DOWN...
_print.Write("^GB780,0,2^FS")
_print.Write("^FO230,60") ' tHIS THE LINE BELOW HMMA RACK ID:
_print.Write("^GB550,0,2^FS")
_print.Write("^FO0,530") ' LINE FOR THE BOTTOM, RIGHT ABOVE # 20
_print.Write("^GB780,0,2^FS") ' LINE FOR THE BOTTOM
_print.Write("^FS^FT16,140")
_print.Write("^A0N,15,17^FD1.^FS")
_print.Write("^FT16,160")
_print.Write("^A0N,15,17^FD2.^FS")
_print.Write("^FT16,180")
_print.Write("^A0N,15,17^FD3.^FS")
_print.Write("^FT16,200")
_print.Write("^A0N,15,17^FD4.^FS")
_print.Write("^FT16,220")
_print.Write("^A0N,15,17^FD5.^FS")
_print.Write("^FT16,240")
_print.Write("^A0N,15,17^FD6.^FS")
_print.Write("^FT16,260")
_print.Write("^A0N,15,17^FD7.^FS")
_print.Write("^FT16,280")
_print.Write("^A0N,15,17^FD8.^FS")
_print.Write("^FT16,300")
_print.Write("^A0N,15,17^FD9.^FS")
_print.Write("^FT16,320") ''
_print.Write("^A0N,15,17^FD10.^FS") '''''''
_print.Write("^FT16,340")
_print.Write("^A0N,15,17^FD11.^FS")
_print.Write("^FT16,360")
_print.Write("^A0N,15,17^FD12.^FS")
_print.Write("^FT16,380")
_print.Write("^A0N,15,17^FD13.^FS")
_print.Write("^FT16,400")
_print.Write("^A0N,15,17^FD14.^FS")
_print.Write("^FT16,420")
_print.Write("^A0N,15,17^FD15.^FS")
_print.Write("^FT16,440")
_print.Write("^A0N,15,17^FD16.^FS")
_print.Write("^FT16,460")
_print.Write("^A0N,15,17^FD17.^FS")
_print.Write("^FT16,480")
_print.Write("^A0N,15,17^FD18.^FS")
_print.Write("^FT16,500")
_print.Write("^A0N,15,17^FD19.^FS")
_print.Write("^FT16,520")
_print.Write("^A0N,15,17^FD20.^FS")
_print.Write(" ^FT12,540")
'_print.Write("^A0N,15,17^FD" & Date.Now & "^FS")
'_print.Write(" ^FT12,580")
_print.Write("^XZ")
_print.EndWrite()
ListBox1.Items.Add(AccessDR.Item(0))
End While
AccessConnection.Close()
Catch ex As Exception
End Try
Exit Sub
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
End Class


----------

