Mandatory Field (1 Viewer)

falcondeer

Registered User.
Local time
Today, 02:48
Joined
May 12, 2013
Messages
101
Hi all,

I used the below code for mandatory fields in many subforms, it is working fine but I have one issue:
If the user entered any field in a specific subform by mistake and want to erase it and go to another subform, he can't until he/she complete all fields before going to the right one. Any solution ?

Code:
If IsNull(Me.PR_Size) Then
MsgBox "Size is required", vbOKOnly
Me.PR_Size.SetFocus
Cancel = True
ElseIf IsNull(Me.PR_Color) Then
MsgBox "Color is required", vbOKOnly
Me.PR_Color.SetFocus
Cancel = True
Else
End If
 
Last edited by a moderator:

oleronesoftwares

Passionate Learner
Local time
Today, 02:48
Joined
Sep 22, 2014
Messages
1,159
If IsNull(Me.PR_Size) Then MsgBox "Size is required", vbOKOnly Me.PR_Size.SetFocus Cancel = True ElseIf IsNull(Me.PR_Color) Then MsgBox "Color is required", vbOKOnly Me.PR_Color.SetFocus Cancel = True Else End If
You can place the code in the subforms before update event
 

Users who are viewing this thread

Top Bottom