Originally posted by alpnz
This gets a little complicated but it's only where the interpreter recognizes properties of an object. Collections don't get shown. It's all about what the interpreter can know at that time.
'A sub routine to print directly to thermal printers with their own language set
Private Sub create_eplab_Click()
' First sort out the variables. Including label content, quantity to print etc
Const quote As String = """"
Dim var1 As String
Dim var2 As String
Dim var3 As String
Dim var4 As String
Dim var5 As String
Dim qty As Integer
' Sort out where the data is coming from. Aim for reusable code
' Declare the variable data values. It assumes we have a simple query which deals with
' consolidating data from various tables into lines of text and values.
var1 = DLookup("[gr]", "qy_elabel")
var2 = DLookup("[pr]", "qy_elabel")
var3 = DLookup("[sz]", "qy_elabel")
var4 = DLookup("[EAN]", "qy_elabel")
var5 = DLookup("[rp]", "qy_elabel")
qty = Int(InputBox("How many labels for the selected line do you wish to print?", "Number of Labels"))
' Code each label combination required. This is where the Printer centric language is dealt with. EPL Or ZPL or Birch, etc etc.
Dim lab1 As String
lab1 = "N" & vbCrLf _
& "S4" & vbCrLf _
& "A30,30,0,4,1,1,N," & quote & [var1] & quote & vbCrLf _
& "A30,150,0,4,2,2,N," & quote & [var2] & quote & vbCrLf _
& "A30,225,0,4,2,2,N," & quote & [var3] & quote & vbCrLf _
& "B30,300,0,E30,2,4,150,B," & quote & [var4] & quote & vbCrLf _
& "A400,400,0,4,1,1,N," & quote & [var5] & quote & vbCrLf _
& "P" & [qty] & vbCrLf
' Print the label to the printer.
Open "COM2:" For Output As #1
Print #1, lab1
Close #1
End Sub
Comment