Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Calendar Control & ActiveControl

Hi,

I have a form with a number of text boxes that require a date value. I want
to use a calendar control form to update each of these text boxes.

My problem is I don't know how to efficiently reference the text boxes to
the calendar control.

At the moment I am trying to use the ActiveControl method in the form code
as below:

Private Sub UserForm_Initialize()
' Check if control with focus contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(UserForm2.ActiveControl.Value) Then
Calendar1.Value = DateValue(UserForm2.ActiveControl.Value)
Else
Calendar1.Value = Date
End If
End Sub

Private Sub Calendar1_Click()
' Transfer date selected on calendar to control with focus
UserForm2.ActiveControl.Value = Calendar1.Value
frmCalendar.Unload
End Sub

The the calendar is is triggered using the enter method for each textbox
selected.
e.g.
Private Sub txReviewDate_Enter()
frmCalendar.Show
End Sub

I think the problem may be to do with using the enter event with the
ActiveControl method as the textbox will not yet have focus.

Any help appreciated.
Thanks,
Marcus
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveControl problem DAACKM Excel Discussion (Misc queries) 3 September 9th 08 01:15 AM
Control disappeared problem - specifically, the Calendar Control JMMach[_2_] Excel Programming 0 December 16th 05 01:53 AM
Calendar Control 9 Ian[_16_] Excel Programming 2 September 26th 05 08:45 PM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM
userform1.activecontrol.name Italian Job Excel Programming 3 November 14th 03 12:43 PM


All times are GMT +1. The time now is 12:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"