I have a field on a form that I want to validate. I did put a validation rule on that field, but I also want to put a validation when the Save button is clicked in case the user doesn't even go to the field. Every time I click on Save (and have left the field blank), I get a run time error 424. When I debug, the if statement in this event is in yellow. For the life of me, I can't figure out what the problem is. below is the code that seems to be throwing the error. Is the problem that I need to do it in a different event or is my code incorrect?
Code:
Private Sub SaveRecordBtn_Click()
If Forms("EnterNewTransactions").Controls("PmtSource").Value Is Null Or _
(Forms("EnterNewTransactions").Controls("PmtSource").Value <> "C" And _
Forms("EnterNewTransactions").Controls("PmtSource").Value <> "K" And _
Forms("EnterNewTransactions").Controls("PmtSource").Value <> "P" And _
Forms("EnterNewTransactions").Controls("PmtSource").Value <> "O" And _
Forms("EnterNewTransactions").Controls("PmtSource").Value <> "L") Then
MsgBox "You must enter a valid payment source."
Cancel = True
Else
DoCmd.Save
TranDate.SetFocus
DoCmd.GoToRecord , , acNewRec
End If
End Sub