How to continue working on current Form after Ok was clicked on msgBox (1 Viewer)

Srussom

Registered User.
Local time
Today, 11:22
Joined
Apr 10, 2018
Messages
15
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:22
Joined
Feb 19, 2002
Messages
43,782
You seem to have multiple versions of this question posted. Please stick with a single instance of each question otherwise you just confuse yourself and waste our time reading and answering questions that have already been answered.
 

Users who are viewing this thread

Top Bottom