A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

date procedure



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2004, 01:11 AM
imbackd
external usenet poster
 
Posts: n/a
Default date procedure

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.
  #2  
Old May 20th, 2004, 01:51 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default date procedure

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/WileyT...764559036.html


"imbackd" wrote in message
news
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.


  #3  
Old May 20th, 2004, 04:17 AM
fredg
external usenet poster
 
Posts: n/a
Default date procedure

On Wed, 19 May 2004 17:11:03 -0700, imbackd wrote:

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))
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.