Calendar and the Updated Event

Steve R.

Retired
Local time
Today, 14:25
Joined
Jul 5, 2006
Messages
5,715
I have Access 2007. I placed the ActiveX Calendar (version 12) on a form. I can get it to partially work. What I was hoping to do was to click on a date and have that date become the stored value. That is not happening.

However, I can get the selected date to store by making a second click on a command button(Set Date) that forces a refresh of the form. Clearly the form experienced a change because refreshing the form updated the text boxes.

The ActiveX calendar has an "On Updated" event. I expected this event to act similar to either the "On Change" event or the "After Update" event for normal controls, but that is not happening. I have attached the test database "CalendarText.mdb"

The code below does not seem to execute. So I am unsure how to get it to execute.
Code:
Private Sub Calendar2_Updated(Code As Integer)
    Me.Text0 = Me.Calendar2.Value
End Sub

I can get the correct result by first clicking on a date, then by clicking on "Set Date" command button. But that takes two clicks. I was hoping that the "On Updated" event would provide one click functionality.

Please note, virtually all the calendar examples that I have run across use the calendar as a pop-up to a text field, which is my current design. I am NOT after that approach. I would like the user to simply directly click on a calendar date. The text boxes on the form are for observing the results, not for data entry.
 

Attachments

Hey Steve, see attached. There are comments in there too.

Wondering why you need a separate calendar control when you've got a built-in one with 2007?
 

Attachments

Last edited:
Wondering why you need a separate calendar control when you've got a built-in one with 2007?
You got me there:confused:. I did not realize that there was one. I will have to look into it. Live and learn.


Hey Steve, see attached. There are comments in there too.
Your revisions are working as expected. Thanks.

But what is also interesting is that when I modify my original database to match what you sent me, it locks-up.:( The question arises as to why?

I noticed that you used the "AfterUpdate" event. The property sheet for the calendar control (Access 2007) does not show the "AfterUpdate" event as an available option.

Is it possible that we have different versions of Access? In your version of Access the "AfterUpdate" option is available and works. In my version (Access 2007) this capability can't be implemented?

Does your property sheet for the calendar control have the "On Updated" event?
 
Yeah there's one. Just format the textbox as a date format using the Format property and set the Show Date Picker property to Yes.

We have the same version :)

With ActiveX controls some of the events are not displayed on the property sheet, but if you look at the events in the drop down menu in the vba editor, you will see all the events associated with the control.

It's locking up because you set the Control Source of the calendar to EventDate. Remove it.
 
Yeah there's one. Just format the textbox as a date format using the Format property and set the Show Date Picker property to Yes.
That's what I currently have. I thought it would be nicer for the users if they could have the calendar "in their face". Just click directly on the date, no need to activate by clicking on the text box.


It's locking up because you set the Control Source of the calendar to EventDate. Remove it.
You've given me something to chew on when I get back to work. Bed time.

PS: You are up really early yourself of have been up all night. True dedication.:)
 
I know what you mean with that built-in calendar. I either get the calendar to pop-up when they hover over or use an Input Mask.

I'm just doing some work at the moment so on here at the same time :)
 
It's working. Yea.:):):):)
Thanks for the advice.
Now, to bed.
 

Users who are viewing this thread

Back
Top Bottom