Validation Rule with 2 fields

  • Thread starter Thread starter L. Mullin
  • Start date Start date
L

L. Mullin

Hi,

Can soemone please help me with a validation rule for a
table (a form validation would work too since the table is
only accessible through a form):

- there is a checkbox called completed
- there is a date field called date

When the checkbox for completed is checked, the date is
required, but when it is not checked, the date is not
required.

Thanks,
 
I would use something like this in AfterUpdate of the form:

IF Completed THEN
IF IsNull(TheDate) THEN
Invalid
ELSE
Valid
END IF
ELSE
Valid
END IF

I would also NOT use "Date" as a field or control name.
It might be a good idea to use CDate to see if TheDate field in fact
contains a valid date.
Pavel
 
in the afterupdate event of the 'completed' checkbox
and the current event of the form

if Me.Completed=true then
Me.Date.Visible = yes
else
me.date.visible=no
endif
 
Back
Top