Validation Rule with 2 fields

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,
 
P

Pavel Romashkin

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
 
T

Tom Ross

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top