Calendar Control Display

J

JamesJ

I'm trying to get an instance of the calendar control to display 2 month
past the current month. The following displays the next month fine:

Me!ctlCalNextMonth = DateSerial(year(Date), month(Date) + 1, 1)

But when I use the following to display 2 months in advance it doesn't
work:

Me!ctlCalNextMonth = DateSerial(year(Date), month(Date) + 1, 2)

Any help will be appreciated,
James
 
T

Tom van Stiphout

On Tue, 19 May 2009 07:51:24 -0400, "JamesJ"

Take another close look at what you are feeding to the DateSerial
function, what each argument stands for, and you should be able to
figure it out.

-Tom.
Microsoft Access MVP
 
B

Beetle

The third argument in the DateSerial function is for the day, so the way
you have it written now;

DateSerial(year(Date), month(Date) + 1, 2)

will display the 2nd of next month. What you need is;

DateSerial(year(Date), month(Date) + 2, 1)

_________

Sean Bailey
 
J

JamesJ

I thought I did understand it.
I thought the second value is for the current month plus 1 month.
Guess not.

James
 
J

JamesJ

This was the first thing I tried but it wont display July.

Me!ctlCalNextMonth2 = DateSerial(year(Date), month(Date) + 2, 1)

I double checked the control's name and that checks out ok. No errors at
all.

James
 
T

Tom van Stiphout

On Tue, 19 May 2009 10:05:01 -0400, "JamesJ"

It does on my machine.

-Tom.
Microsoft Access MVP
 
B

Beetle

Well, there is nothing wrong with how the DateSerial function is written
in your example, so maybe there is a problem with the way your calendar
control is interpreting it. I generally don't use calendar controls, so I
may
not be able to give you an answer if that's the case.

What happens if you do this?

Me!ctlCalNextMonth2 = #7/1/2009#

_________

Sean Bailey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top