Stephen Lebans' Calendar - AfterUpdate does not execute

  • Thread starter Thread starter L Mehl
  • Start date Start date
L

L Mehl

Hello --

The control works fine for setting a date.

I need to detect if the user then double-clicks the date and changes it.

The control's AfterUpdate event does not execute in this situation.

I assume it is my error. Can anyone suggest how I can detect a change?

Thanks for any help.

Larry Mehl
 
Hello Larry.

L Mehl said:
The control works fine for setting a date.
I need to detect if the user then double-clicks the date and changes it.
The control's AfterUpdate event does not execute in this situation.

I assume it is my error. Can anyone suggest how I can detect a
change?

Well, I know how to handle the AfterUpdate event for the Microsoft Calendar
Control. (I think, in newer versions of MS Access, this isn't neccessary,
but in older versions, an ActiceX control seemed to be just some kind of
container that didn't forward all events of the contained control to the
container).
In the form declare a variable as follows (at the module level):
Dim WithEvents mycal as MSCAL.Calendar

Then, in the Open event of the form, set it's value:
Set mycal = Me.calCalendarControl.Object

Now, create event procedures for the calendar by choosing the name of the
variable from the object box in the upper left corner of the code window and
then selecting the event on the right side.

In the Close event of the form, release the memory:
Set mycal = Nothing
 
Wolfgang --

Thank you. I should have said that my version is ACCESS 2000.
Did you need to use this technique for 2000?

Larry
 
Since your code is calling the MonthCalendar function then wherever you have
this code, in a control's Click or Double Click event, simply do something
like:

Store the date you pass to the MonthCalendar function.
Call the MonthCalendar function
When the function returns check the date returned versus the date you passed
to the function. If different then do whatever you want.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Hello Larry.

Thank you. I should have said that my version is ACCESS 2000.
Did you need to use this technique for 2000?

No, you don't have to use the variable in Access 2000.
In the code window, select the name of the control in the object box
(left) and then select AfterUpdate on the right side.
 
Wolfgang --

Thanks. That is how I originally put the code on the AfterUpdate event. It
did not execute, which prompted my original post.

Larry
 
Stephen --

Thank you for responding, and confirming the method of checking for a
difference in dates.

I appreciate your sharing this control with us.

Larry
 
Hello Larry.

Thanks. That is how I originally put the code on the AfterUpdate event.
It did not execute, which prompted my original post.

Before stating that you didn't have to use this techique in Access 2000,
of course I had checked that. After your last reply, I checked it again:
You don't have to use the WithEvents-variable in Access 2000.
There must be some significant difference in what we both did.
So either you don't have Access 2000, or you created the event procedure
another way, maybe you used the Updated event instead of AfterUpdate.
 

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

Back
Top