How to create an Expire field?

lklp

Registered User.
Local time
Today, 01:05
Joined
Aug 18, 2006
Messages
17
I would like to create an Expire Indicator field. This field would automatically check against today's date and if the Expiration_Date equals to TODAY, the indicator would automatically be set to YES.

Does anyone know how to create this field in the table?

Thanks in advance!
 
Hello

Please see the enclosed example for one way to accomplish this. If the date in Field3 equals today, then the check box is checked.
Regards
Mark
 

Attachments

Hello Mark,

Thanks for the example. I have some questions for you.

When I open the file, the 1st record has a date of 8/21/2006 and the Expired field is not check. Once I change the date to 8/22/2006, the Expired field is check. Is there any way that if the date is equal to or less than today, the check box would be check?

In addition, I didn't see any codes or any logics on the form or table. I was curious how you did this?

Thanks for your help!

AC
 
In general, it is difficult to make a TABLE do this. I suppose some tricky default value specification could do it, but the problem is that you are not supposed to have code in a table. You have code in a form or query or report. You can accomplish this by having a startup form that triggers a couple of queries to update required items, but this is the wrong mindset because it is still an impure situation. (What do I mean by impure? Keep reading.)

A table is supposed to be PURE DATA. What you are requesting this checkbox to be is an impure datum that depends on something outside the table. As such, it can NEVER be considered normalized. (It contains something that depends on an item other than the prime key.)

You might find a simple workaround here and there, but this is a VERY BAD mindset to stay in. You should NEVER look to a table to do a query's job. In a query that was based on this table, you can have an expression in one of the fields that compares your target date vs. today in an expression using the "<" or ">" operators. That yields a true/false or yes/no answer that ALWAYS shows the correct state.

Further, almost anything that you can do in a table can be done through a simple table-type query.
 

Users who are viewing this thread

Back
Top Bottom