check box/ if..then..else

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to make a check box which is bound to a "Trainig Date" text box, show
(3) different ways.
1 - Empty if the date field is empty
2 - Shaded if the date in the date field is older than date()-365 but not
empty, and
3 - Checked if the date occurs within the last 365 days.

I'm using the following to get #2 and #3, but the check box gives me a check
for #1 as well...

=IIF(([Training Date])<Date()-365, "Null", "yes")

This gives me a shaded box if the date is older than 365 days, a check if
the date is within the last 365 days, but it also gives me a check for the
filed being empty.

I've tried the Elseif and other conditional statements, but can't seem to
get the syntax correct.

Any suggestions?
 
I need to make a check box which is bound to a "Trainig Date" text box, show
(3) different ways.
1 - Empty if the date field is empty
2 - Shaded if the date in the date field is older than date()-365 but not
empty, and
3 - Checked if the date occurs within the last 365 days.

I'm using the following to get #2 and #3, but the check box gives me a check
for #1 as well...

=IIF(([Training Date])<Date()-365, "Null", "yes")

This gives me a shaded box if the date is older than 365 days, a check if
the date is within the last 365 days, but it also gives me a check for the
filed being empty.

I've tried the Elseif and other conditional statements, but can't seem to
get the syntax correct.

Any suggestions?

Even though your code is incomplete, Null and Yes must not be
surrounded with quotes.

As the control source of an UNBOUND check box control, write:

=IIf(IsNull([TrainingDate]),0,IIf([TrainingDate]<Date()-365,Null,-1))
 
Back
Top