Calendar Control

casey

Registered User.
Local time
Today, 02:35
Joined
Dec 5, 2000
Messages
448
Hello all,

I'm trying to implement a calendar control to insert dates into a textbox that filters a subform on a range of dates. I've read that some people have used the OnClick Event for this control. However, the OnClick Event does not show up for the calendar 9.0 that I've inserted. I see about six Events and none of them accomplish the task as I anticipated they would.
i.e. I would simply like the control to insert its value into the textbox when it has been clicked. The OnClick seems to be what I need, but does someone know how to get it to work as though it's been clicked w/ the Events available?

TIA
 
Don't think it ever had an OnClick Event.

You need to add a command button and use it's OnClick event....

MyTextBox = MyCalendarX.Value
 
O.K. I thought that I could get this to work w/o creating another control.

Again, things work differently than I had expected them to.

It seems odd to me how many controls need to lose focus before their values are updated. The control I'm using would work the way I need if it would update when the value has been changed. However, as you say I would need to click another control for this to happen.

Thanks for your help.
 
Last edited:
To create a click event for a calendar control:

open the form the calendar is placed on in design view - select any event module, select event procedure and choose build (...)

in the module clear out the event sub routine and enter this:

private sub YourCalendarControlName_Click()
me.YourDateTextboxToBeUpdatedName.value = me.YourCalendarControlName.value
end sub
 
I got it to work by adding an apply button to the form as you suggested. The apply button accomplishes the task.

Because of space restrictions, I like to limit the use of command buttons as much as possible. Although this requires the user to make one extra step, the fact that is works is what matters.

Thanks again for your help.
 
I'm not that familiar with that version of the control, but most ActiveX controls have more events than those that are listed on their property sheets. Those listed are usually just the custom events specific to that control.

Try going into the code editor. Select that control from the top of right box, then use the drop down box to the left to see all of the events usable with that control. There may be an On-Click event there.
 
Rakier,

I did what you suggested and I've found the Click Event for the calendar I'm using. I will give it a try and from what I can tell, that should do exactly what I need.

Much appreciation for the advice!
 
It worked! I can delete the command button now and free up some space on my form.

Thank you again.
 
No problem.

Glad I could help.

FYI...When you're using those ActiveX controls, I've found that looking on Microsofts site for info on the controls in Visual Basic is helpful. That's were I learned about those events and stuff.
 

Users who are viewing this thread

Back
Top Bottom