Skip to main content

Search

Search

Print EAN8/EAN13 based on database entry

Comments

6 comments

  • Avatar
    Peter Thane

    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
  • Avatar
    steve steve

    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
  • Avatar
    Peter Thane

    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
  • Avatar
    steve steve

    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
  • Avatar
    steve steve

    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
  • Avatar
    steve steve

    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 names

    3. 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.