Hi guys, I need your help.
I have created a msg box on my data entry Form to show that if all the mandatory fields are completed. when the msg box was shown and Ok was clicked I want the form to remain okay so that I can continue to woke on the form. However the okay button is closing the data entry form. How can I continue working on the data entry form when ok button was pressed.
my code currently is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (IsNull(Me.PPMemebershipID)) Or (IsNull(Me.PFirstName)) Or (IsNull(Me.PLastName)) Or (IsNull(Me.PGender)) Or (IsNull(Me.PDateOfBirth)) Or (IsNull(Me.PDateJoined)) Or (IsNull(Me.PHomePhone)) Or (IsNull(Me.PMobilePhone)) Or (IsNull(Me.PKinFirstName)) Or (IsNull(Me.PKinLastName)) Or (IsNull(Me.PKinTelephone)) Or (IsNull(Me.PKinRelationship)) Then
If MsgBox("Membership ID, First Name, Last Name, Gender, Date of Birth, Date Joined, Home Phone, Mobile Phone, Next of Kin First Name, Next of Kin Last Name, Next of Kin Telephone, Next of Relationship ARE ALL MANDATORY. PLEASE ENTER VALUES IN ALL OF THESE FILEDS", vbOKOnly + VBA.VbMsgBoxStyle.vbExclamation) = vbOK Then
Me.PPMemebershipID.SetFocus
Cancel = True
End If
End If
End Sub
I must tell you that I also have Update and Exit button. in the Update button the code is:
Private Sub Command37_Click()
DoCmd.Close acForm, "InputMain"
and Exit button is:
Private Sub Command38_Click()
Me.Undo
Regards
Solomon
I have created a msg box on my data entry Form to show that if all the mandatory fields are completed. when the msg box was shown and Ok was clicked I want the form to remain okay so that I can continue to woke on the form. However the okay button is closing the data entry form. How can I continue working on the data entry form when ok button was pressed.
my code currently is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (IsNull(Me.PPMemebershipID)) Or (IsNull(Me.PFirstName)) Or (IsNull(Me.PLastName)) Or (IsNull(Me.PGender)) Or (IsNull(Me.PDateOfBirth)) Or (IsNull(Me.PDateJoined)) Or (IsNull(Me.PHomePhone)) Or (IsNull(Me.PMobilePhone)) Or (IsNull(Me.PKinFirstName)) Or (IsNull(Me.PKinLastName)) Or (IsNull(Me.PKinTelephone)) Or (IsNull(Me.PKinRelationship)) Then
If MsgBox("Membership ID, First Name, Last Name, Gender, Date of Birth, Date Joined, Home Phone, Mobile Phone, Next of Kin First Name, Next of Kin Last Name, Next of Kin Telephone, Next of Relationship ARE ALL MANDATORY. PLEASE ENTER VALUES IN ALL OF THESE FILEDS", vbOKOnly + VBA.VbMsgBoxStyle.vbExclamation) = vbOK Then
Me.PPMemebershipID.SetFocus
Cancel = True
End If
End If
End Sub
I must tell you that I also have Update and Exit button. in the Update button the code is:
Private Sub Command37_Click()
DoCmd.Close acForm, "InputMain"
and Exit button is:
Private Sub Command38_Click()
Me.Undo
Regards
Solomon