Dear all,
I am using the following Code to print Bartender Label.
Something strange is that BtFormat.SetNamedSubStringValue
"fih_text2", Rst("barcode")
BtFormat.SetNamedSubStringValue "FihBarcode", Rst("barcode")
will print different content. I checked that the value of
Rst("barcode") should be same. But
BtFormat.SetNamedSubStringValue "FihBarcode", Rst("barcode") will
print different content.
It seems that the old content is brought down to the new Label. I have
already clear the old
content first as you can see in the following code. But it still print
different result. What happened?
Private Sub cmdPrintBarcode_Click()
Dim Cnn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Cnn.ConnectionString = "Provider=SQLOLEDB.1;Password=sa;Persist
Security Info=True;User ID=sa;Initial Catalog=FIH;Data
Source=10.129.2.20"
Cnn.CommandTimeout = 0
Cnn.Open
Dim strSQL As String
Dim strSQL2 As String
Dim BtApp As New BarTender.Application
Dim BtFormat As New BarTender.Format
Set BtFormat = BtApp.Formats.Open("c:\format2.btw")
Rst.CursorLocation = adUseClient
Rst.LockType = adLockOptimistic
Rst.CursorType = adOpenKeyset
strSQL = "select * from invoicebarcode where inbound_number='" &
txtInboundNumber & "' and " & _
"customer_invoice_no = '" & txtInvoiceNo.Text & "'"
Rst.Open strSQL, Cnn
If Not Rst.EOF Or Not Rst.BOF Then
MsgBox "Inbound and Invoice already Exist,please delete first"
Exit Sub
End If
Rst.Close
strSQL = "select field1 from data where dataname = 'barcode'"
Rst.Open strSQL, Cnn
intbarcode = CLng(Rst("field1"))
intAmount = txt_Packaging_Unit
For I = 1 To intAmount
intbarcode = intbarcode + 1
Barcode = "FIH " & String$((9 - Len(CStr(intbarcode))), "0") &
CStr(intbarcode)
strSQL = "insert into InvoiceBarcode ( inbound_number,
customer_invoice_no, barcode) values ('" & _
txtInboundNumber & "','" & txtInvoiceNo.Text & "','" &
Barcode & "')"
Cnn.Execute strSQL
strSQL2 = "insert into event_log
(UserName,Update_Date,Update_time,sql_query) values ('" & _
Global_User_Name & "','" & Date & "','" & Time &
"','" & Replace(strSQL, "'", "''") & "')"
Cnn.Execute strSQL2
Next
Rst.Close
' intbarcode = intbarcode + 1
strSQL = "update data set field1 ='" & CStr(intbarcode) & "' where
dataname = 'barcode'"
Cnn.Execute strSQL
strSQL2 = "insert into event_log
(UserName,Update_Date,Update_time,sql_query) values ('" & _
Global_User_Name & "','" & Date & "','" & Time &
"','" & Replace(strSQL, "'", "''") & "')"
Cnn.Execute strSQL2
strSQL = "select *, invoice.inbound_number as
inbound_number_invoice from invoicebarcode join invoice on
invoicebarcode.inbound_number " & _
" = invoice.inbound_number and
invoicebarcode.customer_invoice_no = " & _
" invoice.customer_invoice_no where
invoicebarcode.inbound_number = '" & txtInboundNumber & "' and
invoicebarcode.customer_invoice_no = '" & txtInvoiceNo & "'"
Rst.Open strSQL, Cnn
While Not Rst.EOF
BtFormat.SetNamedSubStringValue "invoice_text", ""
BtFormat.SetNamedSubStringValue "InvoiceBarcode", ""
BtFormat.SetNamedSubStringValue "fih_text2", ""
BtFormat.SetNamedSubStringValue "FihBarcode", ""
BtFormat.SetNamedSubStringValue "Packages", ""
BtFormat.SetNamedSubStringValue "Inbound_Number", ""
BtFormat.SetNamedSubStringValue "invoice_text",
Rst("customer_invoice_no")
BtFormat.SetNamedSubStringValue "InvoiceBarcode",
Rst("customer_invoice_no")
BtFormat.SetNamedSubStringValue "fih_text2", Rst("barcode")
BtFormat.SetNamedSubStringValue "FihBarcode", Rst("barcode")
BtFormat.SetNamedSubStringValue "Packages",
Rst("inv_packages")
BtFormat.SetNamedSubStringValue "Inbound_Number",
Rst("inbound_number_invoice")
BtFormat.PrintOut
Rst.MoveNext
Wend
BtFormat.Close
Set BtFormat = Nothing
BtApp.Quit
Rst.Close
' Printer.EndDoc
End Sub
Ken Halter - 15 Apr 2008 15:58 GMT
> Dear all,
>
> I am using the following Code to print Bartender Label.
> Something strange is that BtFormat.SetNamedSubStringValue
> "fih_text2", Rst("barcode")
Don't know 'bout chew, but I didn't see a single WinAPI declaration <g> Note
the name of the group.

Signature
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm