AfterUpdate event of Calendar Control in Access 2000 not firing as expected?

G

Gary

Hello,

I am posting this message in hopes someone can help me. I am using the
Microsoft Calendar Control in an Access 2000 database (Version 9). I
noticed the calendar's AfterUpdate event is not firing as expected.
The strange thing is if I start a new form and insert a calendar
control onto this new form and add code to the AfterUpdate event, it
works perfectly. So, I am not sure why the AfterUpdate event doesn't
work on my original form. I then thought that my database might be
corrupted so I repaired and compacted it, but that didn't work.

One other thing. The original database was an Access 97 database that
was converted into an Access 2000 database saved under a new name.
When this was done, an error occurred related to this calendar control
since the version of the control is different between Access 97 and
Access 2000. So, I then deleted and reinserted the calendar control
again (renaming it to match my original calendar control name) and
made sure its corresponding AfterUpdate event was still in the code
window and it was. I also put a dummy message box at the start of the
AfterUpdate event, but again the message did not appear which meant
the AfterUpdate event did not fire. Not sure why.

Does anyone know what is happening or have a solution? Any help is
most appreciated.

I am guessing I may have to recreate the form, which by the way has a
lot of embedded controls on a tab control. I was just trying to avoid
this if I didn't have to. Thanks in advance.
 
G

GVaught

I could be as simple as resetting your references in the new database.
Access 2000 defaults to ADO and not DAO like Access 97 uses. Make sure that
DAO 3.6 is being used.
 
G

Gary

GVaught said:
I could be as simple as resetting your references in the new database.
Access 2000 defaults to ADO and not DAO like Access 97 uses. Make sure that
DAO 3.6 is being used.

Hi,

Thanks for the suggestion but I am afraid I have already checked this.
I am using Microsoft DAO 3.6 Object Library and not ADO (Microsoft
ActiveX Data Objects 2.6 or 2.5 Library). In the references, I
unchecked ADO and then selected DAO 3.6 and then recompiled without
any problems. In my code, I am actually using DAO and not ADO.
Without actually updating all my code, this was the easiest solution.
Besides, that doesn't address the problem I am having with the
calendar control, which is a separate issue.

I am afraid the problem really has something to do with the calendar
control version 9, its file (msCal.ocx), or something else. I am just
not sure. As I pointed out earlier, if I start a new form and add the
calendar control and put it code such as displaying a message box
indicating the selected date in the AfterUpdate event, it works great.
But for some reason, the calendar control isn't working on my original
form that did work in Access 97. I also like to point out that I did
delete the original control and reinserted it into the form just and
renaming it to my original calendar's name so that my code would work.
As another check, I opened the code window and brought up the
AfterUpdate event to make sure it was still there and it was – after
renaming the calendar control back to the original name. I suppose I
am going to have to slowly redo the form but I was hoping not to go
that route. And of course, it may not work even if I do this.

Does anyone have another suggestion? My only other guess is that the
form is corrupted or I have too may controls. As a side note, I did
repair and compact the database but that also didn't solve the
problem. I don't think I have to unregister the control and then
reregister it. Remember, the calendar control works perfectly on a new
form just not on my existing form. By the way, the Access 97 version
of the database also worked perfectly. Anyway, if you can help, that
would be great.

Thanks again.
 
G

Gary

Hello everyone,

I was able to get the calendar control to work properly and its
AfterUpdate event now fires as expected. I am guessing that my
original form somehow got corrupted causing the calendar control's
AfterUpdate event not to work as expected. This may have occurred
during the conversion process from Access 97 to Access 2000, but that
is just a guess. I am not sure why.

The good news is that I have been able to solve the problem and to get
the calendar control to work. The AfterUpdate event now fires as
expected. I had to rebuild the form which took me about 30 minutes.

I rebuilt the form from scratch. By this, I mean I started a new form,
copy all the code from the original form into the new form and then
copy groups of controls from the original form to the new form
excluding the calendar control. I then added the calendar control,
renamed it, and the retested the new form. Happily, everything worked
perfectly.

So if anyone has the same problem I was having, I would suggest
rebuilding the form from scratch. To save time you can copy and paste
code and groups of controls from the original form to the new form.
You just need to reinsert the calendar control by itself and
everything should work out as it did for me.

For a better-looking interface, I would also suggest using the Date
Time Picker control. However, that has one idiosyncrasy, which I don't
like. The Date Time Picker control requires using the right and left
arrow keys to move between the month, day, and year digits, which is a
little inconvenient. For example, for 02/11/2004, you would type in 02
followed by the right arrow key then 11 followed by the right arrow
key and then 2004. If you don't push the use the arrow key, it stays
in the current position without moving over which is a little
unexpected. Unlike a text box with a date type input mask, the date
time picker's entry text box doesn't work the same. However, once you
know that you need to use the arrow keys to move over, it is easy.

Anyway, thanks again and I posted my solution to help others who may
have had the same problem.
 

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