Calendar Control Default Value

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi,
I am using OfficeXP.

Trying on open form event (the calendar is on it) have
the calendar control display certain date (date+30) and
it does not work!

Any suggestions?
Thanks
 
Use the Load event and put this code in:

Private Sub Form_Load()
Me.atxCalendar.Value = Date + 30
End Sub

(Replace atxCalendar with the name of your calendar)
 
Thanks.
i did the same for OpenForm din't work.
did for Load it works..why so?

Thanks any way,Jeff.
May I keep in touch with you Jeff?
I am kinda building some support group. Will be willing
to help you or give an advice if I can..so what you say?

my general e-mail: (e-mail address removed)
Thanks.
 
I believe it is a timing issue with the ActiveX Calendar
Control. The Open event seems to be just a bit too soon
for the value to be loaded. Using the Load event has
always worked for me.

Right here is the BEST Access support group you will EVER
find. Hundreds of some of the best minds sharing Access
ideas from around the world. And it's already created for
you!
 
Thanks.
i did the same for OpenForm din't work.
did for Load it works..why so?

On-open is an event that can be used to cancel the form load. So, code that
tests for certain conditions can and should be placed in the on-open. IF the
form successfully opens..then the on-load event starts to run.

This means that on-open is TOO early to modify any controls. So, you have
this wonderful design split where your testing code, or condition code that
can prevent the form from opening goes into the on-open event.

So, you should as a habit place all your setup and initializing code in the
on-load (this includes setting up values of controls). And, if your code in
the on-open prevents the form from loading..then none of your nice setup
code for controls etc will run.

So, there is actually a distinct of use and purpose for each event.

on-open = check things..can set cancel = true to prevent form load.
(I used this event for record locking testing etc.). If
user can't get a record lock..then I don't
allow the form to be opened)

on-load = everything ok..lets now setup controls defaults, calendar stuff,
setup VB code variable values. etc....
So, general form setup code goes in this event....
 
Back
Top