PC Review


Reply
Thread Tools Rate Thread

Calendar Contol with mutiple textboxes

 
 
Corey
Guest
Posts: n/a
 
      10th Jul 2007
I am using the Textbox_Entyer event to trigger the frmCalender to appear and when a date is selected
it places the date into Textbox1

However further down on the form i have another date textbox (Textbox33)

How can use the SAME frmCalendar to input the date here into Textbox33 as with Textbox1 ?

As the code line i am using to input the date from the Calendar is :


Private Sub Calendar1_Click()
With UserForm1
TextBox1.Value = Calendar1.Value
Unload Me
End Sub

Is there a way to have something like:

Activetextbox or If textbox.setfocus = true then

They did not work though

I do not want to add a2nd frmCalendar


Corey....


 
Reply With Quote
 
 
 
 
Incidental
Guest
Posts: n/a
 
      10th Jul 2007
Hi Corey

I don't have the calendar control installed on this computer but i
believe the code below should work for you though i can't test it as i
said.

Option Explicit
Dim Ctrl As MSForms.Control

Private Sub TextBox1_Enter()
Set Ctrl = UserForm1.Controls("TextBox1")
'call calendar control
End Sub

Private Sub TextBox33_Enter()
Set Ctrl = UserForm1.Controls("TextBox33")
'call calendar control
End Sub

Private Sub Calendar1_Click()
Ctrl.Value = Calendar1.Value
Unload Me
End Sub

hope this helps

S

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help on Form with Combobox and mutiple textboxes, option buttons hansjhamm@yahoo.com Microsoft Access Forms 1 15th Dec 2006 08:27 PM
Accessing Mutiple TextBoxes TimBro Microsoft Excel Programming 1 4th Oct 2004 11:13 AM
Accessing Mutiple TextBoxes TimBro Microsoft Excel Programming 1 1st Oct 2004 05:56 PM
Accessing Mutiple TextBoxes TimBro Microsoft Excel Programming 0 1st Oct 2004 03:16 PM
Accessing Mutiple TextBoxes TimBro Microsoft Excel Programming 1 1st Oct 2004 01:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 PM.