View Single Post
  #3  
Old February 13th, 2007, 04:32 PM posted to microsoft.public.access
Ken Sheridan
external usenet poster
 
Posts: 3,433
Default work out 30 days end of month

You can do the whole thing with a single expression calling the DateSerial
function:

=DateSerial(Year([InvoiceDate]),Month([InvoiceDate])+1,30)

You might think at first sight that if the invoice month is December then
because Month([InvoiceDate])+1 would be 13 this would not work, but in fact
this is correctly interpreted as January of the next year. Similarly, if the
invoice month is January putting 30 as the day argument simply pushes the
date returned forward into March, either 1st or 2nd depending on whether the
year is a leap year or not.

Using zero as the day argument will give you the last day of the invoice
date's month as Bob explained.

Ken Sheridan
Stafford, England

"Nicki" wrote:

Im trying to get a formula that will work out the the due date on an invoice
based on 30 days, end of month.
Im assuming it needs to be something along the lines of Invoice Date + 30 +
difference between the last day of the month and invoice date. i would like
it to work out the last day of the month for me if this is possible. Im new
to databases so please be gentle, im learning from a dummies guide