From: Leo on
If I have a date ('VisitDate')then if I need to know how many days in that
particular month from that given date, the following VBA code helps:

Day(DateSerial(Year([VisitDate]), Month([VisitDate]) + 1, 0))

If I need to calculate the number of days in that month before the visit
date, how will I write a straight forward VBA code like the one above?

Could someone please help?

Thanking you in advance
Leo

From: fredg on
On Sat, 20 Mar 2010 16:53:01 -0700, Leo wrote:

> If I have a date ('VisitDate')then if I need to know how many days in that
> particular month from that given date, the following VBA code helps:
>
> Day(DateSerial(Year([VisitDate]), Month([VisitDate]) + 1, 0))
>
> If I need to calculate the number of days in that month before the visit
> date, how will I write a straight forward VBA code like the one above?
>
> Could someone please help?
>
> Thanking you in advance
> Leo

I'm not sure I understand your question.
If you wish to know how many days from the beginning of the month to
the [VisitDate] all you need do is use
= Day([VisitDate])
So March 20 returns a 20.
If you wish to know how many days from a date to the end of the that
dates month, use:

= DateSerial(Year([VisitDate]), Month([VisitDate]) + 1, 0) -
[VisitDate]

For March 20, 2010 it will return 11
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 | 
Pages: 1
Prev: E_lookup
Next: Query with 2 parameters asks for 3