Skip to main content

Search

Search

Vb Script : In A Batch Print, Identify The Break Between Two Article References And Print A Marker On The First Label

Comments

1 comment

  • Avatar
    Gene Henson

    I've attached two files here.  Just put them in the same directory on your hard drive.

    • Fruit.btw is a BarTender document that has some sample VB scripts to accomplish this. 
    • Fruit.txt is a sample database to be used with the file.

    There are three objects on the label format:

    • Just above the printable region is an object whose sole purpose is to hold the value of the previously printed record from the database.
    • The topmost object in the printable region of the label is the value from the database that is we're currently printing.
    • The bottom object on the label has a script that shows "New Record" whenever #1 changes

    There are two places I've written VBScript in object #3.
     
    OnPrintStart:

    'Called at the start of a print job.
    'This sets the value of the ValueHolder to bogus data when the print job starts.
    'This ensures the first label shows New Record

    Format.NamedSubStrings("ValueHolder").Value = "bogus data"
     
     
    OnNewRecord:

    dim temp

    dim temp2


    'Set temp2 to the current database value

    temp2 = Field("Fruit.Field 1")

     

    'Compare temp2 to the value of "ValueHolder". If it's a new record, set temp to New Record

    If temp2 = Format.NamedSubStrings("ValueHolder").Value Then

        temp = ""

    Else

        temp = "New Record"

    End If

     

    'Set ValueHolder equal to the just printed database field

    Format.NamedSubStrings("ValueHolder").Value = Field("Fruit.Field 1")

     

    Value = temp


     

    0

Please sign in to leave a comment.