Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar Control

Status
Not open for further replies.

BobBob10

Programmer
Apr 24, 2005
57
GB
Hi there I have a calendar control on my form in a frame with 2 text boxes.

What I want to do is to click in one of the text boxes and then click on the calendar and the date will automatically be placed into the text box. Therefore, calendar click event must remember which text box was clicked.

Does anyone know how to do this?
 
use the lost focus event of the text box, to store the name of the text box to a public variable, then on the click event on the calendar just reference the public variabel

Chance,

Filmmaker, gentlemen and I'm on page 157 on the MX Flash Bible
 
VICKEL 1 , i think you find you can.

Chance,

Filmmaker, gentlemen and I'm on page 157 on the MX Flash Bible
 
mouse down would be ok, but what if the person used the tab key ?

Chance,

Filmmaker, gentlemen and I'm on page 157 on the MX Flash Bible
 
1. Chance...there is no LostFocus event that I can find with a Textbox on a UserForm.

There IS a Textbox_LostFocus for an ActiveX textbox control - but that is IN the document, NOT on a UserForm. Could you clarify how you are getting a LostFocus for a textbox control on a UserForm?

2. I am not understanding what is happening here. Why are you clicking the textbox, THEN clicking the calendar? What is the purpose of clicking the textbox? You can put the calendar value into the textbox, among other events, with the Exit event. Such as:
Code:
Sub Calendar1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
   TextBox1.Text = Calendar1.Value
End Sub

Gerry
See my Paintings and Sculpture
 
VBA/VB mixup , would use the exit event.

Chance,

Filmmaker, gentlemen and I'm on page 157 on the MX Flash Bible
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top