Calendar crashing!

  • Thread starter Thread starter david anon
  • Start date Start date
D

david anon

MSCAL.OCX calendar control works fine on my desktop PC -
it is reused on a pop-up form to populate dates throughout
the application.

When packaged & installed to other PCs, the form crashes
the runtime. Deleting the ocx from the client PC stops
this very simple form from crashing the PC - but obviously
the app. doesn't work without it.

Any ideas about how to fix this?

Form has a calendar and an OK button, nothing more. The
calendar control is unbound, and the code behind the form
is dead simple:-

Private Sub cmdOK_Click()
If Not (IsDate(Me.Calendar1)) Then Me.Calendar1 = Date
Me.Visible = False
End Sub
 
Private Sub cmdOK_Click()
If Not (IsDate(Me.Calendar1)) Then Me.Calendar1 = Date
Me.Visible = False
End Sub

One thing I have found is that you ALWAYS want to use the "value" property
of the control. While leaving it out works on most pc's, I have found that
one some pc's, if you don't use the value function, then the control
crashes. So, try using:

Private Sub cmdOK_Click()
If Not (IsDate(Me.Calendar1.Value)) Then Me.Calendar1.Value = Date
Me.Visible = False
End Sub
 
Hi David,

I don't have an explanation for the calendar control to crash in your
situation, but have found a few bugs myself in the calendar control.

I found a calendar control that crashes when the value property of the
calendar control is being assigned a value from another form (I wrote a
wrapper property get/set in the form which contains the calendar control).

I found calendar controls which only work a single time after selecting a
day (registered another newer version calendar control and the problem was
gone). Also registering a calendar control is not always straight forward
(often only after unregistering and then registering a couple of times the
control works).

In MSAccess97 the properties of the calendar control suggest there is an
update event, but there isn't. Instead there are before and after update
events (you will have to write the event function framework manually,
because the property wizard doesn't).

The calendar control is a strange beast, but i managed to get it on his
knees.

Sid.
 
Back
Top