Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a field required based on another selection. 1

Status
Not open for further replies.

rkb0378

IS-IT--Management
Mar 12, 2002
16
US
I am planning on using the "before update" event to validate a field.

Can someone help fill in the english with some code!!!

The form is used to enter different types of work.

If WorkType.value = "Payroll" then
[PAYROLL END DATE] is required.
else
do nothing
End If

Thanks

Rob

 
Something like this should do what you need.

Code:
If  WorkType.value = "Payroll" then
    [COLOR=Blue]If IsNull([PAYROLL END DATE]) then
        MsgBox "You must enter an End Date", VBOKOnly, "Missing End Date"
        Cancel = True
        Me.[Payroll End Date].SetFocus
    End If[/color]
else 
do nothing
End If

HTH
Lightning

NB: Code TYPED, not CHECKED
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top