How do I change default months in Lebans' MonthCalendar function?

B

Bob Gajewski

I have attempted to use Steve Lebans' "MonthControl" solution
(http://www.lebans.com/monthcalendar.htm) for populating a date field
on a form. Of course, it works wonderfully - as programmed.

However, for the purposes of my specific form, the user will almost
always be entering data from the previous month. If I double-click on
my IncidentDate field today (7/6/08), the popup shows July, August and
September - but they will probably need June.

Does anyone know where/how I can insert the DateAdd("mm",-1,Date) code
to have the it default to June, July and August (last month, this
month and next month)? I tried to work with the dtStart value, but my
code keeps failing ...

Stephen - I'm told on the AccessD list that you may frequent this list ?!?

TIA,
Bob Gajewski
 
C

Cheese_whiz

Hi Bob,

I think what you need to do is open your form in design view. Left click
the text box where the date is going (the place you double-click to get the
month control to open), show the properties window (f4), choose the 'Event'
tab in the properties window, and look down for the 'On Dbl Click' event,
which should have [Event Procedure] beside it in the white box.

Click in the white box where it says [Event Procdure], then hit the ...
button to the right of that box. All that gets you to the procedure in
question.

In that procedure, he has a line that reads like this:

dtStart = Date

Change that to:

dtStart = DateAdd("m", -1, Date)

See if that works.

CW
 
B

Bob Gajewski

CW

Okay - it was a syntax error. Instead of:

dtStart = Nz(Me.IncidentDate.Value, 0)

I had to change it to:

dtStart = Nz(Me.IncidentDate.Value, DateAdd("m", -1, Date))

Unfortunately, using the double-click method now loses both the
_BeforeUpdate() event and the SelStart, SelLength settings. So, I may not use
this after all.

Thanks anyways - you definitely led me to my error ("mm" where it should
have been "m").

Bob

Cheese_whiz said:
Hi Bob,

I think what you need to do is open your form in design view. Left click
the text box where the date is going (the place you double-click to get the
month control to open), show the properties window (f4), choose the 'Event'
tab in the properties window, and look down for the 'On Dbl Click' event,
which should have [Event Procedure] beside it in the white box.

Click in the white box where it says [Event Procdure], then hit the ...
button to the right of that box. All that gets you to the procedure in
question.

In that procedure, he has a line that reads like this:

dtStart = Date

Change that to:

dtStart = DateAdd("m", -1, Date)

See if that works.

CW

Bob Gajewski said:
I have attempted to use Steve Lebans' "MonthControl" solution
(http://www.lebans.com/monthcalendar.htm) for populating a date field
on a form. Of course, it works wonderfully - as programmed.

However, for the purposes of my specific form, the user will almost
always be entering data from the previous month. If I double-click on
my IncidentDate field today (7/6/08), the popup shows July, August and
September - but they will probably need June.

Does anyone know where/how I can insert the DateAdd("mm",-1,Date) code
to have the it default to June, July and August (last month, this
month and next month)? I tried to work with the dtStart value, but my
code keeps failing ...

Stephen - I'm told on the AccessD list that you may frequent this list ?!?

TIA,
Bob Gajewski
 

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