Calculating an Expiration Date from 2 Different fields

alelover

Registered User.
Local time
Today, 03:00
Joined
Nov 5, 2008
Messages
12
Hi All,
I'm kinda new at this access stuff and not real good at all this code stuff. What I want to do is calculate an expiration date for 2 criteria. If a product is invoiced I want it to expire 1 year from the invoice date. If the invoice date has a null value I want it to use the install date and expire 3 years from that date. I have a table with the install date, invoice date and expiration date fields. Then on the form I want it to put a Yes or No in a text box so I know at a glance if it is expired or not. The If/Then looks something like this.

ExpirationDate = InvoicedDate + 1 Year
If InvoicedDate = Null
Then ExpirationDate = InstallationDate + 3 Years
If ExpirationDate >= Today
Then Expired = Yes
If ExpirationDate < Today
Then Expired = No

How do I make it into code that Access understands? I tried the DateAdd function which worked but it doesn't do everything I need. Thanks for any help. :confused:
 
what doesnt dateadd do? I would think that it could accomplish everything you needed
 
I have 2 columns with dates in them. InstallationDate and InvoiceDate. If the InvoiceDate column has a null value I want it to use the date from the InstallationDate column. Once in a while both columns will have a date. If so then use the date from the InvoiceDate column. If it's from the InvoiceDate column it expires in 1 year. If it pulls from InstallationDate I want it to expire in 3 years. If DateAdd will work, how do I do it? I messed with it but never got it to work right. Then whatever day it is I want to be able to look at the particular record and see a Yes or No in a text box that tells me if it's expired or not.
 

Users who are viewing this thread

Back
Top Bottom