R
randria
hi,
I have a control on a subform that has conditions and if they are not met an
error message pops up ( on lost focus ). Now I realised that the users might
ignore the error and continue. What I would like to happen is either:
-The user cannot move out from that control until the value is corrected
or
-a code sets the value to meet the condition on lost focus.
my codes
Private Sub N0Unit_LostFocus()
If Me.N0unit = 0 And (Me.Service = 5 Or Me.Service = 9 Or Me.Service = 12)
Then
MsgBox (" N0Unit can't be 0.")
Else
If Me.N0unit <> 0 And Not (Me.Service = 5 Or Me.Service = 9 Or Me.Service
= 12) Then
MsgBox (" Please set the value of N0Unit to 0")
Else
End If
End If
End Sub
Your help is appreciated.
I have a control on a subform that has conditions and if they are not met an
error message pops up ( on lost focus ). Now I realised that the users might
ignore the error and continue. What I would like to happen is either:
-The user cannot move out from that control until the value is corrected
or
-a code sets the value to meet the condition on lost focus.
my codes
Private Sub N0Unit_LostFocus()
If Me.N0unit = 0 And (Me.Service = 5 Or Me.Service = 9 Or Me.Service = 12)
Then
MsgBox (" N0Unit can't be 0.")
Else
If Me.N0unit <> 0 And Not (Me.Service = 5 Or Me.Service = 9 Or Me.Service
= 12) Then
MsgBox (" Please set the value of N0Unit to 0")
Else
End If
End If
End Sub
Your help is appreciated.