Label Validation
Good Morning
I am connected to our ERP database and the user scans the Job Number and Assembly Number. I then use this info to check to make sure the part number for the job they are working on matches the label number:
Here is the Code:
ReferenceField("JobAsmbl.PartNum")
if Field("JobAsmbl.PartNum") <> "1004206" then
Format.CancelPrinting "This is not the correct Label for the part, please
verify you are scanning the correct Job and Assembly and Try again"
end if
I have placed it in the OnNewRecord event.
The problem is, the first time I try to print a label it gives me the cancel printing error above, but I know the record exists. Without changing anything I try it again and it works just fine.
I am open to other ways to do this also.
Any help would be greatly appreciated.
Thanks
Chris
-
I'd move it to the print time event
0 -
I moved it to the 'OnPrintJobStart' event but now I am not getting the cancel printing error message, it just goes right back to the printstation main window.
0 -
I am outside my realm of knowledge, maybe a moderator will help you.
0 -
Shotaro Ito
★ BarTender Hero ★
Assuming that you're using BarTender 10.1 Automation edition or above, you can have condition for a template to print.
in Page setup > templates, you can specify when to print the main template such as database value doesn't match a number.
Another thought is keep the script in OnNewRercord of a text datasource then insert the line below at the beginning of the script.
If Format.IsPrinting = false Then Exit sub
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
4 Kommentare