Print EAN8/EAN13 based on database entry
is it possible to print either ean8 or ean13 barcode based on excel database entry?
for example:
so first print will print ean8 barcode and second print will print ean13 barcode type.
-
Peter Thane
★ BarTender Hero ★
The simplest way is to just add one of each type of barcode onto the label and link both to the same field in the database. I seem to recall you get an error message in older versions of BarTender is the number of digits is correct, but you could then disable this in Administer>Application Message Setup screen, but having just tried this in 2019 R4 the warning is not displayed at print time.
If you wanted to get more sophisticated you could add additional layers, one with the EAN8 and one with the EAN13 and then configure these with conditional printing based on the length of the data field in your spreadsheet.
0 -
steve steve
★ BarTender Hero ★
Hi Peter thanks for your reply.
I tried both and seems to like the add new layer method as it is cleaner without having to disable error messages.
however i have not found a way to specify "when to print layer 3" based on number of characters in datasource. I attach the screenshot
0 -
Peter Thane
★ BarTender Hero ★
Hi,
You could use the greater than or less than options, i.e if the barcode is greater than 100000000, then use the EAN13 layer.
Alternatively you could add a new named Data Source off to one side of the label (so it doesn't print) and set this as an Event Controlled > OnNewRecord VB script routine.
- Give the field a default value by setting the AutoSelectedEvent to Value = "8"
- Then chose the OnNewRecord and add
Value = <click on the barcode field name in the list of database fields in the column on the right>
If Len(Value) > 8 then
Value = "13"
else Value = "8"
end if
Once the VB routine is setup you can then use the Equals option from the conditional printing options
0 -
steve steve
★ BarTender Hero ★
Hi Peter thanks for your helpful message. I got your description to work using layers. It looks neater without something off the label that i may forget and delete in the future.
However it only worked using new XLS database. I cant seem to get it to work on my existing XLS database. What I can tell to be the difference:
1.new dB only 2-3 lines and 2-3 columns. old dB some hundreds that have been faithful so far
2.new dB barcode column is number type. old dB was text type. but changing it to number didnt do the trick. Seems like the layer cannot tell if the barcode is > or < 100000000 or i may have some mayhem with the database because browsing it on "database connection setup" sometimes mixes the columns up.
Any clues? meanwhile i will search support for xls as database
this is the error message. The same data on new xls database yields the right output
"Bar Code 1" is supposed to be printed only if barcode is >= 100000000
0 -
steve steve
★ BarTender Hero ★
new update: the same data prints as barcode, but when using the same data for "print when" on layer properties, it freezes and give this error. tried to cut down the number of rows to only 4, and tried to copy the 4 rows to new file. both didnt fix the ole db problem.
0 -
steve steve
★ BarTender Hero ★
ok here is my eureka moment:
1. the OLE DB IDispatch error #3088 is because i had 2 identical column headers. fixed it
2. absolutely essential: db conn setup-status-refresh field names3. my "layer properties print when condition" broke and it had to be manually re-typed (the 100 million number). make sure that the greater/less than reference number has up down arrow. if it does not, do #2 above again
0
Please sign in to leave a comment.
Comments
6 comments