Hi,
Im having some issues with some code and i would be grateful for a bit of advice if you can decipher what i am trying to do from the below code! In summary, this code works once, and then if i force an error again, i get a data mismatch error and am prompted to End or Debug. Clearly something is wrong!
Let me know if I need to explain what i am trying to achieve......this is my code at present:
Private Sub PrintBarcodeToggle_Click()
If Me.PrintBarcodeToggle = True Then
Me.Qty.Visible = True
Me.Qty.SetFocus
Me.Del.Enabled = True
Me.PrintBarcodeToggle.Caption = "Confirm Print"
Me.PrintBarcodeToggle.ForeColor = vbRed
Else
Me.Qty.Visible = False
End If
If Me.PrintBarcodeToggle = False Then
If IsNull(Me.Qty) Then
Me.PrintBarcodeToggle = True
Me.Qty.Visible = True
MsgBox "Please enter a valid qty to print"
Me.Qty = ""
Me.Qty.SetFocus
Else
DoCmd.OpenReport "50x50", acViewPreview
DoCmd.PrintOut , , , , Me.Qty.Value
DoCmd.close
Me.PrintBarcodeToggle.Caption = "Barcode Only"
Me.PrintBarcodeToggle.ForeColor = vbBlack
Me.Qty = ""
Me.Qty.Visible = False
Me.No1.SetFocus
Me.MultiPrint.Visible = False
Me.Del.Enabled = False
End If
End If
End Sub
Suggestions greatly welcome!
Many thanks,
Im having some issues with some code and i would be grateful for a bit of advice if you can decipher what i am trying to do from the below code! In summary, this code works once, and then if i force an error again, i get a data mismatch error and am prompted to End or Debug. Clearly something is wrong!
Let me know if I need to explain what i am trying to achieve......this is my code at present:
Private Sub PrintBarcodeToggle_Click()
If Me.PrintBarcodeToggle = True Then
Me.Qty.Visible = True
Me.Qty.SetFocus
Me.Del.Enabled = True
Me.PrintBarcodeToggle.Caption = "Confirm Print"
Me.PrintBarcodeToggle.ForeColor = vbRed
Else
Me.Qty.Visible = False
End If
If Me.PrintBarcodeToggle = False Then
If IsNull(Me.Qty) Then
Me.PrintBarcodeToggle = True
Me.Qty.Visible = True
MsgBox "Please enter a valid qty to print"
Me.Qty = ""
Me.Qty.SetFocus
Else
DoCmd.OpenReport "50x50", acViewPreview
DoCmd.PrintOut , , , , Me.Qty.Value
DoCmd.close
Me.PrintBarcodeToggle.Caption = "Barcode Only"
Me.PrintBarcodeToggle.ForeColor = vbBlack
Me.Qty = ""
Me.Qty.Visible = False
Me.No1.SetFocus
Me.MultiPrint.Visible = False
Me.Del.Enabled = False
End If
End If
End Sub
Suggestions greatly welcome!
Many thanks,