date procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i need to know how to call an event procedure that will take a day in a month and give a number of days of difference to the end of the month.
 
Because February can have a different length every four years, I think you
should also specify the year.

Public Function Days2EOM(dteDate As Date) As Integer
'Calculates the number of days till the end of the specified month
Days2EOM = DateDiff("d", dteDate, DateSerial(Year(dteDate),
Month(dteDate) + 1, 0))
End Function

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


imbackd said:
i need to know how to call an event procedure that will take a day in a
month and give a number of days of difference to the end of the month.
 
i need to know how to call an event procedure that will take a day in a month and give a number of days of difference to the end of the month.
Why an event procedure?
In a Query.....
Difference:
DateDiff("d",[ADate],DateSerial(Year([ADate]),Month([ADate])+1,0))

As control source in an unbound control:
= DateDiff("d",[ADate],DateSerial(Year([ADate]),Month([ADate])+1,0))
 
Back
Top