Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic Expiration(after 1 year) Updating Daily 1

Status
Not open for further replies.

damien110281

Programmer
May 21, 2001
6
IE
Hi all,

What I need is to return an automatic "Expired" warning on goods more than a year old .This has to be calculated daily so I suppose I'll have to use Date() and I'm guessing an if else statement. Any tips much appreciated. It would be handy aswell if I could label the length of the expiration.egA after 1 year, B after 2 etc.
Where would be the best place to put such a code if I need the warning in a form and Table?

THanks
Damien
 

If you want to create a report of expired goods or display the list on screen, you should create a query that finds the expired goods. The query can be used as the record source for a report or form.

Example:

Select
ProductId,
ProductName,
ProductDate,
DateDiff("m",[ProductDate],Date()) AS Age,
IIf([Age]=0,"","Expired") AS Status

FROM ProoductTbl;

You can add criteria to find only expired goods with this Where clause.

Where DateDiff("m",[ProductDate],Date()) > 0 Terry

People who don't take risks generally make about two big mistakes a year. People who do take risks generally make about two big mistakes a year. -Peter Drucker
 
Use an update query in you want it reflected in the table. All that's needed is somehow scheduling it for daily execution.

As it may be calculated if the received date is in the table, or another table, that calculation may be built into a control on the form. The query may even be part of the forms On Open event in which case the control just reflects the field in the table.


Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top