Conditionally Print A Certain # Of Labels
Hello,
I currently have a label format that pulls information from an access database, on the 'copies per serial number' field I have had it set to a field within the database that calculates the number of labels needed for each product on an order. This works perfectly fine.
What I would like to do is add a checkbox on the data entry form and a number input box, if the checkbox is checked then I want to print the number of labels in the number input box. If the checkbox is not checked then I want to use my database field.
Here is what I have done in the format so far:
Added the checkbox and number input box to the data entry form, and connected them to "Embedded Data" named data sources. On the checkbox I have set the Checked Value to be "Y" and the Unchecked Value to be "N".
Named Data Source names:
CheckboxData
NumberData
I have changed the Data Source for Copies per Serial Number to be a Visual Basic Script, script type Event Control Scripts.
Here is where I am getting lost, which event should I be making this determination in? OnPrintStart or OnPostPrompt?
What should the script look like (I am new to VBScripting)?
I assume it would be something like:
-
Seems like you're pretty close to the solution you're looking for. I'm not sure it'll work, but it's worth a shot.
I suggest you put the final script in the "OnPostPrompt" event as the script requires data that's only available after the data entry / prompt dialog has been filled.
What your script is missing is assignment to the "Value" variable. Otherwise, the script / BarTender won't know what to do with your "Then"-statements.
If Format.NamedSubStrings("CheckboxData").Value = "N" Then Value = Field("Labels") ElseIf Format.NamedSubStrings("CheckboxData").Value = "Y" Then Value = Format.NamedSubStrings("NumberData").Value End If1
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar