PDA

View Full Version : userform toolbox



mortred
03-04-2009, 04:22 AM
how can i put a value in a textbox specifically a date that uses a calendar as a tool.
also i wanted to place a option button that if selected will disable a certain toolbox in a userform

pls help..

Bob Phillips
03-04-2009, 05:11 AM
Add the calendar control to the form, and just get Value porperty and load the texbox with that.

mortred
03-04-2009, 06:24 AM
thanks a lot xld

how about i have a several option button in a userform that when selected will simultaneously disable a certain textbox in a userform

Bob Phillips
03-04-2009, 06:42 AM
Yeah, you can do that


Private Sub CommandButton1_Click()
With Me.Textbox1
.Enabled = .Enabled
End With
End Sub

mortred
03-04-2009, 09:30 PM
i've done the textbox disabling process but i still have problem with the calendar in the userform.

what i wnted to do is a combobox loaded with calendar...
im going to select a date and then this will be the value in the box..
can u pls help...
with certain detail pls.im just new with vba.

Chris Bode
03-05-2009, 12:19 AM
Well, first of all I provide you the codes to enable/disable the text box on the selection of a check box
1. Place a textbox and a check box on the user form


Private Sub CheckBox1_Click()
TextBox1.Enabled = CheckBox1.Value
End Sub

2. Now for adding calendar control to your user form, select Microsoft Calendar Control11.0 from the components dialog box.
3. Add the calendar control to the user form and add following codes to the code window


Private Sub Calendar1_Click()
TextBox1.Text = Calendar1.Value
End Sub

Bob Phillips
03-05-2009, 01:41 AM
i've done the textbox disabling process but i still have problem with the calendar in the userform.

what i wnted to do is a combobox loaded with calendar...
im going to select a date and then this will be the value in the box..
can u pls help...
with certain detail pls.im just new with vba.

What do you mean by ... a combobox loaded with a calendar?

mortred
03-05-2009, 01:55 AM
What do you mean by ... a combobox loaded with a calendar?


its like a dropdownlist that will pop up a calendar when selected
i assumed it is a combo box becoz thats how i imagine it looks like.....
is it possible?

Bob Phillips
03-05-2009, 01:57 AM
Popup for what purpose, what do you want to do with it?

mortred
03-05-2009, 02:26 AM
just for selecting a date for the specific textbox so that it will not consume space in the userform

Bob Phillips
03-05-2009, 03:35 AM
Now you are confusing me. You started by saying combobox, now you are saying Textbox. What are you trying to do, just save the selected calendar date on the form somewhere?

mortred
03-05-2009, 04:20 AM
Now you are confusing me. You started by saying combobox, now you are saying Textbox. What are you trying to do, just save the selected calendar date on the form somewhere?



I will use the userform for data entry and i have several textboxes...
while encoding on the boxes that does not require a date entry i dont want the calendar to appear in the form, when im about to encode a required date the calendar will appear.