Making a field required based on another value

Sol

Registered User.
Local time
Today, 18:00
Joined
Feb 24, 2000
Messages
31
How can I make a field be required only if another field is not null?
 
Set that text box Visible property to False by default. Then,write a little VB code that set that text box Visible property to True if the other text box is not Null.
 
In the BeforeUpdate event of the FORM, put code that tests the first field for null. If it is null, test the second field. If an error condition exists, display a message box, cancel the update, and set focus to the field that needs to be changed.

If Len(Me.fld1) > 0 then
If Len(Me.fld2) = 0 then
Cancel = True
Me.txtfld2.SetFocus = True
Msgbox "Enter a value in fld2", vbOKOnly
end if
end if
 

Users who are viewing this thread

Back
Top Bottom