Hi,
I have a label printing program which as a novice has taken me a while to build but works like a dream at the moment. I often however find that when someone wants to print say 4 labels, they click into the commondialog copies and change the 1 to 4 (all is good), but a lot of times they dont pay attention to what they type and they actually add the 4 infront of or behind the 1. They press enter or return and whoops, out pops 14 or 41 labels.
Ive tried to write this code into the print button on the program but it doesnt seem to have the desired effect.
Dim ExceedMaxPrint
If CommonDialog1.Copies > 10 Then
ExceedMaxPrint = MsgBox("You are about to print 10 or more copies, do you want to continue?", 36)
If ExceedMaxPrint = 6 Then
Printer.EndDoc
Else: Exit Sub
End If
End If
What im trying here is to tell the user they are trying to print more that 10 labels, and then give them the choice of continuing the print or cancelling it so they can review the quantity.
I dont know if its needed but the entire code behind the print button is:
Private Sub cmdprint_Click()
If Chkopenwrite.Value = 1 Then
frmprnprev.lblPartN.Caption = frmfind.txtpartno.Text
frmprnprev.LblpartnoBrc.Caption = frmfind.txtpartno.Text
frmprnprev.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev.LblLocBrc.Caption = frmfind.txtloc.Text
frmprnprev.lblLoc.Caption = frmfind.txtloc.Text
frmprnprev.LblRevbrc.Caption = frmfind.txtrev.Text
frmprnprev.lvlRev.Caption = frmfind.txtrev.Text
frmprnprev1.lblPartN.Caption = frmfind.txtpartno.Text
frmprnprev1.LblpartnoBrc.Caption = frmfind.txtpartno.Text
frmprnprev1.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev1.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev1.LblLocBrc.Caption = frmfind.txtloc.Text
frmprnprev1.lblLoc.Caption = frmfind.txtloc.Text
frmprnprev1.LblRevbrc.Caption = frmfind.txtrev.Text
frmprnprev1.lvlRev.Caption = frmfind.txtrev.Text
ElseIf Chkopenwrite.Value = 0 Then
frmprnprev.lblPartN.Caption = frmfind.lblPartN.Caption
frmprnprev.LblpartnoBrc.Caption = frmfind.lblPartN.Caption
frmprnprev.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev.LblLocBrc.Caption = frmfind.lblLoc.Caption
frmprnprev.lblLoc.Caption = frmfind.lblLoc.Caption
frmprnprev.LblRevbrc.Caption = frmfind.lblrev1.Caption
frmprnprev.lvlRev.Caption = frmfind.lblrev1.Caption
frmprnprev1.lblPartN.Caption = frmfind.lblPartN.Caption
frmprnprev1.LblpartnoBrc.Caption = frmfind.lblPartN.Caption
frmprnprev1.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev1.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev1.LblLocBrc.Caption = frmfind.lblLoc.Caption
frmprnprev1.lblLoc.Caption = frmfind.lblLoc.Caption
frmprnprev1.LblRevbrc.Caption = frmfind.lblrev1.Caption
frmprnprev1.lvlRev.Caption = frmfind.lblrev1.Caption
End If
frmprnprev.lblQTY.Caption = frmfind.TxtQTY.Text
frmprnprev.LblqtyBrc.Caption = frmfind.TxtQTY.Text
frmprnprev.LblFor.Caption = frmfind.TxtFor.Text
frmprnprev.lbltime.Caption = frmfind.lbltime.Caption
frmprnprev1.lblQTY.Caption = frmfind.TxtQTY.Text
frmprnprev1.LblqtyBrc.Caption = frmfind.TxtQTY.Text
frmprnprev1.LblFor.Caption = frmfind.TxtFor.Text
frmprnprev1.lbltime.Caption = frmfind.lbltime.Caption
CommonDialog1.DialogTitle = "RTA Label Printer"
CommonDialog1.CancelError = True
CommonDialog1.PrinterDefault = False
On Error Resume Next
CommonDialog1.ShowPrinter
If Err Then
MsgBox "Print Cancelled"
Exit Sub
End If
Printer.ScaleMode = 6
Printer.FontSize = 8
Printer.CurrentY = Printer.CurrentY + 180
Printer.Copies = CommonDialog1.Copies
If FrmDB.Combo1.Text = "Zebra / Datamax" Then
frmprnprev1.PrintForm
End If
If FrmDB.Combo1.Text = "Dymo Label Writer" Then
frmprnprev.PrintForm
End If
Dim ExceedMaxPrint
If CommonDialog1.Copies > 10 Then
ExceedMaxPrint = MsgBox("You are about to print 10 or more copies, do you want to continue?", vbYesNo)
If ExceedMaxPrint = vbYes Then
Printer.EndDoc
Else: Exit Sub
End If
End If
TxtSearch.SetFocus
Dim reply
reply = MsgBox("Would you like to clear all fields?", 36)
If reply = 6 Then
TxtSearch.Text = ""
TxtFor.Text = ""
TxtQTY.Text = ""
TxtLotR.Text = ""
txtpartno.Text = ""
txtloc.Text = ""
txtrev.Text = ""
DataEnvironment1.rsCommand1.MoveFirst
TxtSearch.SetFocus
CmdPrint.Default = False
CmdSearch.Default = True
CommonDialog1.Copies = 1
Else: CommonDialog1.Copies = 1
End If
End Sub
The label being printed is just set up on a standard form. The information being typed on one form is copied to another and the results printed.
If anyone can advise, that would be greatly appreciated.
Thanks
D
I have a label printing program which as a novice has taken me a while to build but works like a dream at the moment. I often however find that when someone wants to print say 4 labels, they click into the commondialog copies and change the 1 to 4 (all is good), but a lot of times they dont pay attention to what they type and they actually add the 4 infront of or behind the 1. They press enter or return and whoops, out pops 14 or 41 labels.
Ive tried to write this code into the print button on the program but it doesnt seem to have the desired effect.
Dim ExceedMaxPrint
If CommonDialog1.Copies > 10 Then
ExceedMaxPrint = MsgBox("You are about to print 10 or more copies, do you want to continue?", 36)
If ExceedMaxPrint = 6 Then
Printer.EndDoc
Else: Exit Sub
End If
End If
What im trying here is to tell the user they are trying to print more that 10 labels, and then give them the choice of continuing the print or cancelling it so they can review the quantity.
I dont know if its needed but the entire code behind the print button is:
Private Sub cmdprint_Click()
If Chkopenwrite.Value = 1 Then
frmprnprev.lblPartN.Caption = frmfind.txtpartno.Text
frmprnprev.LblpartnoBrc.Caption = frmfind.txtpartno.Text
frmprnprev.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev.LblLocBrc.Caption = frmfind.txtloc.Text
frmprnprev.lblLoc.Caption = frmfind.txtloc.Text
frmprnprev.LblRevbrc.Caption = frmfind.txtrev.Text
frmprnprev.lvlRev.Caption = frmfind.txtrev.Text
frmprnprev1.lblPartN.Caption = frmfind.txtpartno.Text
frmprnprev1.LblpartnoBrc.Caption = frmfind.txtpartno.Text
frmprnprev1.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev1.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev1.LblLocBrc.Caption = frmfind.txtloc.Text
frmprnprev1.lblLoc.Caption = frmfind.txtloc.Text
frmprnprev1.LblRevbrc.Caption = frmfind.txtrev.Text
frmprnprev1.lvlRev.Caption = frmfind.txtrev.Text
ElseIf Chkopenwrite.Value = 0 Then
frmprnprev.lblPartN.Caption = frmfind.lblPartN.Caption
frmprnprev.LblpartnoBrc.Caption = frmfind.lblPartN.Caption
frmprnprev.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev.LblLocBrc.Caption = frmfind.lblLoc.Caption
frmprnprev.lblLoc.Caption = frmfind.lblLoc.Caption
frmprnprev.LblRevbrc.Caption = frmfind.lblrev1.Caption
frmprnprev.lvlRev.Caption = frmfind.lblrev1.Caption
frmprnprev1.lblPartN.Caption = frmfind.lblPartN.Caption
frmprnprev1.LblpartnoBrc.Caption = frmfind.lblPartN.Caption
frmprnprev1.lblprbarc.Caption = frmfind.TxtLotR.Text
frmprnprev1.lblPRN.Caption = frmfind.TxtLotR.Text
frmprnprev1.LblLocBrc.Caption = frmfind.lblLoc.Caption
frmprnprev1.lblLoc.Caption = frmfind.lblLoc.Caption
frmprnprev1.LblRevbrc.Caption = frmfind.lblrev1.Caption
frmprnprev1.lvlRev.Caption = frmfind.lblrev1.Caption
End If
frmprnprev.lblQTY.Caption = frmfind.TxtQTY.Text
frmprnprev.LblqtyBrc.Caption = frmfind.TxtQTY.Text
frmprnprev.LblFor.Caption = frmfind.TxtFor.Text
frmprnprev.lbltime.Caption = frmfind.lbltime.Caption
frmprnprev1.lblQTY.Caption = frmfind.TxtQTY.Text
frmprnprev1.LblqtyBrc.Caption = frmfind.TxtQTY.Text
frmprnprev1.LblFor.Caption = frmfind.TxtFor.Text
frmprnprev1.lbltime.Caption = frmfind.lbltime.Caption
CommonDialog1.DialogTitle = "RTA Label Printer"
CommonDialog1.CancelError = True
CommonDialog1.PrinterDefault = False
On Error Resume Next
CommonDialog1.ShowPrinter
If Err Then
MsgBox "Print Cancelled"
Exit Sub
End If
Printer.ScaleMode = 6
Printer.FontSize = 8
Printer.CurrentY = Printer.CurrentY + 180
Printer.Copies = CommonDialog1.Copies
If FrmDB.Combo1.Text = "Zebra / Datamax" Then
frmprnprev1.PrintForm
End If
If FrmDB.Combo1.Text = "Dymo Label Writer" Then
frmprnprev.PrintForm
End If
Dim ExceedMaxPrint
If CommonDialog1.Copies > 10 Then
ExceedMaxPrint = MsgBox("You are about to print 10 or more copies, do you want to continue?", vbYesNo)
If ExceedMaxPrint = vbYes Then
Printer.EndDoc
Else: Exit Sub
End If
End If
TxtSearch.SetFocus
Dim reply
reply = MsgBox("Would you like to clear all fields?", 36)
If reply = 6 Then
TxtSearch.Text = ""
TxtFor.Text = ""
TxtQTY.Text = ""
TxtLotR.Text = ""
txtpartno.Text = ""
txtloc.Text = ""
txtrev.Text = ""
DataEnvironment1.rsCommand1.MoveFirst
TxtSearch.SetFocus
CmdPrint.Default = False
CmdSearch.Default = True
CommonDialog1.Copies = 1
Else: CommonDialog1.Copies = 1
End If
End Sub
The label being printed is just set up on a standard form. The information being typed on one form is copied to another and the results printed.
If anyone can advise, that would be greatly appreciated.
Thanks
D