I am attempting to set up password protection to fields in a form. I need for the form to display an error message if the signature does not match any of the defined names. This is my code. It seems to be completely bypassing the code that tells it to what to do if the name is not in the defined names list. Please help!!!
Private Sub Supplier_Signature_BeforeUpdate(Cancel As Integer)
Dim update As Variant
Dim password As Variant
If [Supplier Signature] = "XXX" Then
update = InputBox("Enter Password", password)
End If
If [Supplier Signature] = "XXX" And update <> "1280" Then
MsgBox ("Please enter the correct password")
DoCmd.CancelEvent
If [Supplier Signature] <> "ABC" Or "DEF" Or "GHI" Or "JKL" Or "MNO" Or "PQR" Or "STU" Or "VWX" Or "YZA" Or "BCD" Or "EFG" Or "HIJ" Or "KLM" Or "NOP" Or "QRS" Or "TUV" Or "WXY" Or "ZAB" Or "CDE" Or "FGH" Or "IJK" Or "LMN" Or "OPQ" Or "RST" Or "UVW" Or "XYZ" Or "ACB" Or "DFG" Or "JKM" Then
MsgBox ("Either you are not authorized to complete this form or you have entered an invalid name. Please try again")
DoCmd.CancelEvent
Else
If [Supplier Signature] = "MNA" Then
update = InputBox("Enter Password", password)
End If
Private Sub Supplier_Signature_BeforeUpdate(Cancel As Integer)
Dim update As Variant
Dim password As Variant
If [Supplier Signature] = "XXX" Then
update = InputBox("Enter Password", password)
End If
If [Supplier Signature] = "XXX" And update <> "1280" Then
MsgBox ("Please enter the correct password")
DoCmd.CancelEvent
If [Supplier Signature] <> "ABC" Or "DEF" Or "GHI" Or "JKL" Or "MNO" Or "PQR" Or "STU" Or "VWX" Or "YZA" Or "BCD" Or "EFG" Or "HIJ" Or "KLM" Or "NOP" Or "QRS" Or "TUV" Or "WXY" Or "ZAB" Or "CDE" Or "FGH" Or "IJK" Or "LMN" Or "OPQ" Or "RST" Or "UVW" Or "XYZ" Or "ACB" Or "DFG" Or "JKM" Then
MsgBox ("Either you are not authorized to complete this form or you have entered an invalid name. Please try again")
DoCmd.CancelEvent
Else
If [Supplier Signature] = "MNA" Then
update = InputBox("Enter Password", password)
End If
Last edited: