Help w/ Date in an If Statement

G

Guest

Hi. I'd like to write an If Statement that will insert an employee's name in
an unbound text box depending on the date in another field. For example, if
the date entered in [Date] is greater than or equal to 05/15/2005 I'd like it
to return John Smith, otherwise I'd like it to return Jane Doe. The
following is returning John Smith every time, regardless of the date entered:

= IIf ([Date] >= "05/15/2005", "John Smith", "Jane Doe")

Would I need to add another date field to my table, insert the 05/15/05 date
in it, and refer to the new field in my statement instead of the date itself,
or is their a better way?
 
G

George Nicholson

Try using # as a date delimiter rather than " (a string delimiter):
= IIf ([Date] >= #05/15/2005#, "John Smith", "Jane Doe")

HTH,
 
G

Guest

Thanks!

George Nicholson said:
Try using # as a date delimiter rather than " (a string delimiter):
= IIf ([Date] >= #05/15/2005#, "John Smith", "Jane Doe")

HTH,
--
George Nicholson

Remove 'Junk' from return address.

Katherine R said:
Hi. I'd like to write an If Statement that will insert an employee's name
in
an unbound text box depending on the date in another field. For example,
if
the date entered in [Date] is greater than or equal to 05/15/2005 I'd like
it
to return John Smith, otherwise I'd like it to return Jane Doe. The
following is returning John Smith every time, regardless of the date
entered:

= IIf ([Date] >= "05/15/2005", "John Smith", "Jane Doe")

Would I need to add another date field to my table, insert the 05/15/05
date
in it, and refer to the new field in my statement instead of the date
itself,
or is their a better way?
 

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

Similar Threads


Top