Eljefegeneo
Still trying to learn
- Local time
- Today, 10:59
- Joined
- Jan 10, 2011
- Messages
- 902
I am trying to set a "Due Date" of the 15th of the month 3 months in advance. For example, if I send out an invoice for May, and select that month as the invoice Month, I use the function:
To give me the Date of May 1. Currently I am using in a query the following to set the Due Date"
But this, of course does not always give me the 15 of the month. Using May 1 it gives me a DueDate of 14-Aug-20.
I've wracked my brains trying to figure this one out but can't seem to find a solution. I know that there is one, probably a very simple one, but my mind is a blank right now.
Thanks
Code:
Public Function FDIM(Optional dtmDate As Date = 0) As Date
' Return the first day in the specified month.
If dtmDate = 0 Then
' Did the you pass in a date? If not, use
' the current date.
dtmDate = Date
End If
FDIM = DateSerial(Year(dtmDate), _
Month(dtmDate), 1)
End Function
Code:
DueDate: [Fdate]+105 where
Fdate: FDIM([Forms]![frmMainMenu]![InvoiceMonth])
But this, of course does not always give me the 15 of the month. Using May 1 it gives me a DueDate of 14-Aug-20.
I've wracked my brains trying to figure this one out but can't seem to find a solution. I know that there is one, probably a very simple one, but my mind is a blank right now.
Thanks