Zum Hauptinhalt gehen

Suche

Suche

Saving Serialization Number To Start Next Print

Kommentare

11 Kommentare

  • Avatar
    Fernando Ramos Miracle
    Moderator
    Indeed the way to go would be using the "update data source after print" feature.

    The reason why you've got it greyed out is because you are serializing a value coming from a database. It is not possible to update a "Database" type data source, understand that when serializing this type of data source the first value will always be the one coming from the database.

    Could you try using an "Embedded Data" type data source instead? this should allow you to update the data source after printing. If you save the document after printing, this updated value will be saved too.
    0
  • Avatar
    Legacy Poster
    I'd like to point out this is one of the most requested things I see related to BarTender and serial numbers - the ability to instantly keep track of numbers you've printed. Yes, BarTender has a logging system, but your format will not automatically check the log first before printing numbers.

    If there was some way to do that (check previous numbers run under that format) and automatically use the next number, or warn when about to print numbers already done, it would do a lot for a lot of users.
    0
  • Avatar
    Fernando Ramos Miracle
    Moderator
    1. In order to update a serial number printed on a label, the "update data source" feature should certainly do the trick.

    On the other hand, there is the possibility to have BarTender remember the printed records from a database and not allow the user to print them again. Below you'll find the description and files from an example we developed through VB script and using an Excel spreadsheet:

    2. The best way to go about doing this is to create an additional field in the Excel worksheet to act as a "Label printed" flag. When a record is used to print a label a value is written to the "Label printed" field marking it as having been printed. A query can be used when connecting to the Excel file which omits any records that have the "Label printed" field set.

    3. Unfortunately BarTender in terms of its database connectivity is a read-only application. This means that in order to write back a value to a printed database record we will need to use BarTender's built-in VB Scripting capability. Attached you will find a simple example which will do just that. In the Excel file there are two fields, one for a product and the other which flags when the product's record has been printed.

    In the BarTender label format I have made a connection to the Excel file, which assumes it will be found in the "C:\Seagull" folder. It uses a query to only find and therefore possibly print those products (records) that do not have the word "YES" in the "Printed" column. The select record at print time option is turned on allowing the user to select which of the records that have not been printed, are to be printed.

    During the print job the VB script contained in the object in red placed off the label, runs a section of code that connects to the Excel file, finds the record being printed and sets the "Printed" field to the value "YES" so that next time the user prints it will not be available in the select at print time dialog to choose. The VB script is as follows.

    OnNewRecord event

    'Define the object names.
    dim objConn
    dim strConn
    dim rs

    'Define the database connection parameter constants.
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    Const adCmdText = &H0001

    'Connect to the Excel file.
    Set objConn = CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='[color="#FF0000"]C:\Seagull\Fruits.xls[/color]';Extended Properties=""Excel 8.0;HDR=YES;"""

    'Create a record set of one record which is the current record being printed.
    Set rs = CreateObject("ADODB.Recordset")
    rs.open "SELECT * FROM [[color="#FF0000"]Sheet1$[/color]]", objConn, adOpenStatic, adLockOptimistic, adCmdText
    rs.Find "[color="#FF0000"]Product[/color] = '" & Field("[color="#FF0000"]Sheet1$.Product[/color]") & "'"
    'Set the "Printed" field of the record to be "YES" thus flagging it as having been printed.
    rs.Fields("[color="#FF0000"]Printed[/color]") = "YES"
    rs.Update

    The items marked in [color="#FF0000"]red[/color] can be changed according to your Excel path and filename, and the names of the fields you wish to find and update. You can use this example to apply for your own label printing needs. If you have any questions, please feel free to ask.

    *As I'm not allowed to attached Excel files on the forum you'll need to create a new one to use in the example with the attached image format.

    Please let me know how you get on.


    By the way:
    There is a FAQ (Frequently Asked Questions) page available on our website which provides answers to many of the most common support questions. Be sure to take a look should you encounter any further problems in the future. The FAQ page is found at the link below:

    http://www.seagullscientific.com/aspx/FAQ.aspx

    Many thanks!
    0
  • Avatar
    Legacy Poster

    Hi Fernando,

    I read through your email that puts some hope that I may solve my issue here. I just installed Bartender Automation yesterday and I love it!

    My issue is:

    I have an XLS file that I would like to print records from - that is easy - no problem.

    It contains the columns:

    ID, Product, Full Qty, Slit Qty

     

    The operator is slitting the material. after the material is slit he prints the label, during printing enters the Slit Qty that is printed.

    My problem is to get this Slith Qty back to the XLS sheet.

     

    Thanks for your help.

    0
  • Avatar
    Fernando Ramos Miracle
    Moderator

    Hello tmalar,

     

    Your issue is basically the same one as the original question, the only difference is that you don't wish to simply "mark" the record, but also enter a specific value to it.

     

    The solution is quite easy, if you take a look at the code from my example you'll note that the "marking" action takes place at the end, where it says:

    rs.Fields("Printed") = "YES"

     

    In your case you need to change the field reference to the one from your database and change "YES" with the reference to where the actual data is stored. The latter will usually be a named data source in your document, so that line of code would look as follows:

    rs.Fields("Printed") = Format.NamedSubStrings("<SubstringName>").Value

     

    Of course you need to have previously loaded the proper data onto that named data source.

     

    Regards.

    0
  • Avatar
    Legacy Poster

    HI,

    I have a similar issue where the "Update Data Source After Print" is greyed out - but I am using an Embedded field type from an Access DataBase connection.

     

    Is there something else that I am missing ?

     

    [attachment=1208:bartender.png]

     

    Regards
    Steve

    0
  • Avatar
    Fernando Ramos Miracle
    Moderator

    HI,

    I have a similar issue where the "Update Data Source After Print" is greyed out - but I am using an Embedded field type from an Access DataBase connection.

     

    Is there something else that I am missing ?

     

    attachicon.gifbartender.png

     

    Regards
    Steve

     

     

    Hello Steve, in order to be able to update a data source after printing (this refers to the actual data source you are applying the data entry control over in BarTender) you first need to relate the data source with the data entry control (create a new one or select and existing one). Once you do so that option will become available.

     

    *Note that the option you are referring to updates the value of the data source in the BarTender object after printing, there is not "writing back to the database" action.

     

    Regards.

    0
  • Avatar
    Legacy Poster

    Can I just ask a silly/simple question ....

     

    I am trying to create a serialized field in either SQL or Access.

     

    Am I able to update a field so that multiple labels link to this field, giving a unique serialized number for all labels ?

     

    Regards

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    FYI, in BarTender v10.1 we have implemented this feature by making use of the same BarTender system database (this is an SQL Server database) which we use for logging print job data. This feature is called "global data field" and will allow you to share the same serial number between several BarTender documents on the same computer (in the Automation Edition) or even between different BarTender computers (in the Enterprise Automation Edition). This is covered in our "What's New in BT v10.1 White Paper":

    http://www.seagullscientific.com/label-software/whitepapers/whitepaper_whatsnewinbt101.pdf

    0
  • Avatar
    Legacy Poster

    Hi,
    I have copied the VB script example from above and am getting an error message as detailed below ;
     
    The following script error was found;
     
    OnNewRecord(Line 23): : Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record
     

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    Steve,

     

    Did you already check the v10.1 Global Data Field feature?

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.