Sol
10-18-2000, 09:55 AM
How can I make a field be required only if another field is not null?
|
View Full Version : Making a field required based on another value Sol 10-18-2000, 09:55 AM How can I make a field be required only if another field is not null? lamha 10-18-2000, 10:57 AM 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. Pat Hartman 10-18-2000, 03:38 PM 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 |