Solved Setting a Due Date

Eljefegeneo

Still trying to learn
Local time
Yesterday, 21:48
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:
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
To give me the Date of May 1. Currently I am using in a query the following to set the Due Date"
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
 
Hi. Have you tried?
Code:
DueDate: DateSerial(Year(Forms!frmMainMenu.InvoiceMonth),Month(Forms!frmMainMenu.InvoiceMonth)+3,15)
 
That is what I was going to say. Here in function form
Code:
Public Function ThreeOut(Optional dtmDate As Date = 0) As Date
  If dtmDate = 0 Then dtmDate = Date
  ThreeOut = DateSerial(Year(dtmDate), Month(dtmDate) + 3, 15)
End Function
 
Hi. Have you tried?
Code:
DueDate: DateSerial(Year(Forms!frmMainMenu.InvoiceMonth),Month(Forms!frmMainMenu.InvoiceMonth)+3,15)
Worked fine except That I had to use:

Code:
DueDate: DateSerial(Year(Fdate),Month(Fdate)+3,15)
because when I pasted the above it kept putting in [] and the query didn't seem to like that. Thank you. Can now go back to doing nothing again, stuck at home and the golf course is still closed.
 
Worked fine except That I had to use:

Code:
DueDate: DateSerial(Year(Fdate),Month(Fdate)+3,15)
because when I pasted the above it kept putting in [] and the query didn't seem to like that. Thank you. Can now go back to doing nothing again, stuck at home and the golf course is still closed.
Hi. Glad to hear you got it to work. Good luck with the rest of your project.
 
That is what I was going to say. Here in function form
Code:
Public Function ThreeOut(Optional dtmDate As Date = 0) As Date
  If dtmDate = 0 Then dtmDate = Date
  ThreeOut = DateSerial(Year(dtmDate), Month(dtmDate) + 3, 15)
End Function
This also worked great. Thank you so much.
 

Users who are viewing this thread

Back
Top Bottom