print from sql database and write to another database Follow



How could I print lables with a list of serial numbers from a SQL database? The problem is that they are mostly in series but sometimes a number might be missing and that shouldn't be printed. Serial numbers will be returned by an order number sent as SQL command.

I thought about connecting a database but couldn't set it up. There are several joins and setting it up is different from SQL commands, so I couldn't do it. Also, I'm not sure how I would add the order no imput.

Could I use serialize and OnProcessData? If so then how?

The part about writing info to another database and checking duplicates I can do. Did something similar to another project.


Xabier Clemente
Comment actions Permalink

Hi Kardo!

Thank you for reaching us with your query on our BarTender Community Forums.

Have you tried using Conditional Printing? If what we need is to prevent BarTender from printing when certain fields are empty, the easiest way of achieving this would be through the use of a conditional expression. Here are some resources which I believe should prove to be of use to you, please review them as they go through the basics of Conditional Printing:

Let us know if these were of help to you!

Kardo Aia
Comment actions Permalink


Unfortunatelly this is a different thing.

Maybe I should try to explain better.

I have a SQL database where I need to get serial numbers for a specific work order. The problem is they are not on the same table so query to SQL database getting the serial numbers in a work order has several inner joins.

This is the reason I couldn't set it up as printing from database (Database connection setup under printing). Setting that up was a lot different than just sending an SQL query. And I'm even not sure if it's possible that way to input work order and then get answer from database using that method.

What I'm doing right now:

OnPrintJobStart (vbscript): Ask work order. Send SQL query that finds all serial numbers corresponding to that work order. I get back serial numbers. Find smallest and amount. Print them (set SN to smallest and print qty to amount). The problem with this method is that in some rare cases, a serial number might be skipped (meaning not in the database, so shouldn't be printed) and I can't acheive this right now. So I need to

All serial numbers will be printed on different lables if that makes a difference. And the lables themselves are different, some have just SN, some also have barcode for it and some have other fields that is set on the template.

Please sign in to leave a comment.