跳到主内容

搜索

搜索

Preventing Certain Records Being Printed

评论

14 条评论

  • Avatar
    Michael Toupin (mtoupin

    The easiest way to do this would be with a VB script.  You'll want to put something like

     

    If History = 0 then 

    value = format.cancelprinting("Are you sure you want to print this?")

     

    This would result in a popup with the request whether or not to continue printing.

    0
  • Avatar
    Legacy Poster

    Many thanks for your reply Mike,

     

    Whereabouts would i add the VBScript for it to prompt? In the query?

     

    Regards

     

    Ryan

    0
  • Avatar
    Legacy Poster

    Hello again,

     

    I've tried various different places of adding vb but still not getting the results i'm after.

     

    Should i move this to the scripting forum? Or is there another way to solve my problem?

     

    Regards

     

    Ryan

    0
  • Avatar
    Fernando Ramos Miracle

    Hello Ryan,

     

    You could create a new object with a Vb script type data source and use an event based script. The code would need to be added to the "OnNewRecord" event so it acts when the new record of your database is selected.

     

    Another option would be to use a document level script (from the "File>BarTender document options..." dialog, under the VB Scripting tab), using the same event.

     

    *Please note that you'll need to reference correctly your database field and close the "If...Then" statement.

     

    If Field("Table.History") = "0" Then

       Value=format.cancelprinting("Are you sure you want to print this?")

    End If

     

    Regards

    0
  • Avatar
    Legacy Poster

    Excellent stuff,

     

    Thank you both very much, i have it sorted now.

     

    For those in the same position, i used the document level script as suggested by Fernando and used the following in the 'OnNewRecord' script

     

    ReferenceField("YourTable.YourField")

     

    If Field("YourTable.YourField")= "0" Then

     

    Value=format.cancelprinting("Are you sure you want to print this?")

     

    End If

    0
  • Avatar
    Legacy Poster

    Further development.............This doesnt seem to work in Print Station, even though the label through Bar Tender works as it should.

     

    Any ideas?

     

    Regards

     

    Ryan

    0
  • Avatar
    Fernando Ramos Miracle

    Hello Ryan,

     

    I've been doing some tests and I can certainly make it work as expected in Print Station.

     

    1. Could you let me know what version of BarTender are you working with?

     

    2. Make sure you are working with the latest release available for your BarTender version. You'll find the download link for the latter on the below webpage (you'll need to select your version):

    http://www.bartenderbarcodesoftware.com/label-software/service-releases.aspx

     

    3. As you are working with a document level script, please avoid using the "Value=" part of the code (there's no object actually taking that value). Instead try the below code:

     

    ReferenceField("YourTable.YourField")
     
    If Field("YourTable.YourField")= "0" Then
     
    Format.cancelprinting("Are you sure you want to print this?")
     
    End If
    0
  • Avatar
    Legacy Poster

    We are using Bar Tender Automation 10.1 SR2

     

    Regards

     

    Ryan

    0
  • Avatar
    Legacy Poster

    For some reason, your 3rd option didn't show up on my screen when i looked.

     

    Removing the value= part seems to have done the trick B)

     

    Thanks again

     

    Regards

     

    Ryan

    0
  • Avatar
    Legacy Poster

    .............sorry i'm back

     

    For some reason it will not work on the very first time the lookup is performed. I know the script is in the 'OnNewRecord' event but it will only seem to work after the first lookup has been processed.

     

    To replicate the error, close down print station, then open up. The first time you search it will go through as if the value doesn't equal 0, then if you run the same search again, the code will kick in and show the message box

     

    Any thoughts?

     

    Regards

     

    Ryan

    0
  • Avatar
    Fernando Ramos Miracle

    That is strange and definitively shouldn't happen. Could you attach the latest version of your document so I can take a look at it?

     

    Could you also let me know what version, edition and build of BarTender are you working with? Make sure you've got installed the latest release for your BarTender version:

    http://www.bartenderbarcodesoftware.com/label-software/service-releases.aspx

     

    Regards

    0
  • Avatar
    Legacy Poster

    Hello,

     

    We are using BarTender Automation Edition 10.1 SR2 which i think is the latest release?

     

    I'm not too keen on attaching the document due to the sensitivity of the information, it's also llnked to a database that exists on our internal server so would it still be useable?

     

    Regards

     

    Ryan

    0
  • Avatar
    Fernando Ramos Miracle

    Indeed that is the latest release at the moment.

     

    Could you instead build a simple test document implementing the code and try to reproduce your issue? You could then attach this sample so I can see exactly what might be going on.

     

    Regards.

    0
  • Avatar
    Legacy Poster

    Ok will do

     

    Many thanks

     

    Ryan

    0

请先登录再写评论。