require a field based on data in another field (1 Viewer)

bevans

New member
Local time
Today, 13:58
Joined
May 30, 2000
Messages
7
Hello,
I am trying to create a form that requires one field to have data only when another field is changed/updated.

Any help is greatly appreciated!
Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:58
Joined
Feb 19, 2002
Messages
43,346
Do your editing in the form's BeforeUpdate event. If fldA is not null but fldB is, use a msgbox to display an error message and cancel the record update by setting cancel to true -

If IsNull(fldA) Then
Else
If IsNull(fldB) Then
MsgBox "Field B must not be null", vbOKOnly
Cancel = True
End If
End If
 

Users who are viewing this thread

Top Bottom