I want a user to select option button which will control the text length in a text box.
Some users may fill e.g. text upto 200 characters, some to 400 characters etc. to describe an event in the same text box in a userform I have designed.
I do not have any code but can anybody suggest please. code or reference any thing.
i tried following code
i have a user form with three options for printing a form.
The user selects the format by choosing option button 1 or 2 or 3. it opens another userform "frmMEDForm"to fill various details.
if opt button 1 is selected, it changes one combo box in the "frmMEDForm" to choose 1 to 12 Sr. No. to fill upto 12 lines with 70 character limit, hides two of the three command buttons and displays only one required to print the form.
if opt button 2 is selected, it changes the same combo box to choose 1 to 6 Sr. No. to fill upto 6 lines with 200 character limit, ...
if opt button 3 is selected, it changes the same combo box to choose only one Sr. No. to fill 1 lines with 600 character limit, ...
every other aspect is working fine but just the combo box working...
After selecting opt button 1 first, combo box is empty , however it should show sr no. 1 to 12
Then if opt button 2 is selected, combo box shows 1 to 12 Sr No. but it should show 1 to 6 SrNo.
Then if option button 3 is selected it shows, 1 to 6 Sr No. and not just 1 Sr No. as it should be and so on.....
Some line to reset the combo box is missing but I dont know where to place it.
Request please guide to resolve.
the code is as follows:
VBA Code:
Private Sub opt1_Click()
If opt1.Value = True Then
frmMEDForm.txbDescription.MaxLength = 70
End If
frmMEDForm.cmdFinalizeXL.Visible = True
frmMEDForm.cmdFinalize.Visible = False
frmMEDForm.cmdFinalizeS.Visible = False
frmMEDForm.Show
With frmMEDForm.cmbSrNo
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
.AddItem "10"
.AddItem "11"
.AddItem "12"
End With
End Sub
Private Sub opt2_Click()
If opt2.Value = True Then
frmMEDForm.txbDescription.MaxLength = 150
End If
frmMEDForm.cmdFinalize.Visible = True
frmMEDForm.cmdFinalizeXL.Visible = False
frmMEDForm.cmdFinalizeS.Visible = False
frmMEDForm.Show
With frmMEDForm.cmbSrNo
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
End With
End Sub
Private Sub opt3_Click()
If opt3.Value = True Then
frmMEDForm.txbDescription.MaxLength = 500
End If
frmMEDForm.cmdFinalizeS.Visible = True
frmMEDForm.cmdFinalizeXL.Visible = False
frmMEDForm.cmdFinalize.Visible = False
frmMEDForm.Show
With frmMEDForm.cmbSrNo
.AddItem "1"
End With
End Sub