hi, I am developing a form for adding employees where you can find three fields in the table employees (firstname, middlename, lastname, hiredate (Is Not Null)
and ADezii prompt me to use this code and it gives me the msgboxes which I need to be viewed to the user but after that It gives me an error because the code which I used for save cmdbutton is
please help me handling this problem because I want to make a form for adding employees without any error
thanks in advance for any help you may provide me
and ADezii prompt me to use this code and it gives me the msgboxes which I need to be viewed to the user but after that It gives me an error because the code which I used for save cmdbutton is
Code:
private sub save_click() docmd.save docmd.requery (the error because of this I think) end sub
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![firstname]) Then
MsgBox "You must enter a First Name before this Record can be saved"
Cancel = True: Me![firstname].SetFocus
ElseIf IsNull(Me![middlename]) Then
MsgBox "You must enter a Middle Name before this Record can be saved"
Cancel = True: Me![middlename].SetFocus
ElseIf IsNull(Me![lastname]) Then
MsgBox "You must enter a Last Name before this Record can be saved"
Cancel = True: Me![lastname].SetFocus
ElseIf IsNull(Me![hiredate]) Then
MsgBox "You must enter a Hire Date before this Record can be saved"
Cancel = True: Me![hiredate].SetFocus
End If
End Sub
thanks in advance for any help you may provide me
Comment