Skip to main content

Search

Search

Populate Field On Format With Event Control Script

Comments

4 comments

  • Avatar
    Domingo Rodriguez
    Moderator
    You can achieve this e.g. with the following VBScript code:

    If Objects ("Barcode 1"). value = 12345678 Then
    Format.NamedSubStrings("mytext").Value = "Yes"
    End If

    "mytext" is a shared sub-string which you've created previously by opening the properties of the text / bar code object in BarTender and now selecting the "Data Source" tab. Press the "More Options..." button and you will now see a "Share / Name" sub-tab. It is here where you can place the name of your substring to be e.g. "mytext"
    0
  • Avatar
    Legacy Poster
    This code seems to work in the OnPrintJobStart method - but not on the OnNewRecord, OnSerialize, or OnIdenticalCopies (and probably others, but those are the ones I've tried). Those three simply return an error "Cannot write to read only property".

    Thanks.
    0
  • Avatar
    Legacy Poster
    [quote name='nRyder' timestamp='1325183398' post='1415']
    This code seems to work in the OnPrintJobStart method - but not on the OnNewRecord, OnSerialize, or OnIdenticalCopies (and probably others, but those are the ones I've tried). Those three simply return an error "Cannot write to read only property".

    Thanks.
    [/quote]

    Still no answer on why this is the case? Can anyone replicate the experience I'm having? (Sub-string value can be set OnPrintJobStart, but not other methods)
    0
  • Avatar
    Gene Henson
    Hello nRyder,

    Actually, this is by design. Document level VB Scripts are not allowed to modify object substrings during those three events. The best workaround is to use a data sourced VB Script to change the substring value as needed.

    Will that work for you?

    Sorry for any inconvenience that causes and for the wait time in getting you a response.
    0

Please sign in to leave a comment.