Date question, check if date is before today

I

iTanas

Hi, I have a table with warranty information, storing the date that warranty
ends for a specific computer, in a field fld_warrantyEND . I would like to
have another field fld_Valid which says either 'yes' or 'no' if the warranty
is expired or not (expired if it ended before today, not expired if today's
date is less than fld_warrantyEND). Of course I might want to make it so
that it displays the number of days remaining, but thats after I figure out
the first part. I'm relatively new to Access, so not quite sure how to
accomlish this, any help would be appreciated. Thanks a lot.
 
J

John Vinson

Hi, I have a table with warranty information, storing the date that warranty
ends for a specific computer, in a field fld_warrantyEND . I would like to
have another field fld_Valid which says either 'yes' or 'no' if the warranty
is expired or not (expired if it ended before today, not expired if today's
date is less than fld_warrantyEND). Of course I might want to make it so
that it displays the number of days remaining, but thats after I figure out
the first part. I'm relatively new to Access, so not quite sure how to
accomlish this, any help would be appreciated. Thanks a lot.

fld_Valid should NOT EXIST in your table, if indeed it can be
determined directly from the value in fld_warrentyEND.

Instead calculate it dynamically in a Query by using a calculated
field:

fld_Valid: ([fld_warrentyEND] > Date())

This expression will be TRUE (-1) if the warrenty ends today or later,
and FALSE if it ends before today's date. You can display this field
on a Form or Report in a textbox formatted "yes/no".

To show how many days remain in the warranty, you can use

DaysLeft: DateDiff("d", Date(), [fld_warrentyEND])


John W. Vinson[MVP]
 

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