ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Force minimum text box entry (https://www.excelbanter.com/excel-programming/304154-force-minimum-text-box-entry.html)

JBL[_3_]

Force minimum text box entry
 
Hello All,

I have an IsEmpty in my current code that is not working when tied to a
command button to exit the form.

Private Sub CommandButton7_Click()
'determine which button was selected
With AddNew
Select Case True
Case .OptionButton1.Value:
MsgBox "Calculate Repair Only Selected"
Case .OptionButton2.Value:
MsgBox "Calculate & Print Repair Selected"
Case .OptionButton3.Value:
MsgBox "Calculate Repair & Add to Data File Selected"
End Select
End With
If IsEmpty(AddNew.TextBox38.Value) Then
MsgBox "The repair number must be made before proceeding!"
Else

MsgBox "The active cell value is OK"
End If
AddNew.MultiPage1.Value = 1
End Sub

Since this is a tabbed form, will this only work on the complete closure of
the form? It does not make sense.

I also want to verify that the text box entry is numeric 6 digits only. I
have set the text box to Characters 6 in properties, so I know I can't have
more than 6 characters, and I have the numeric validation created, what I am
having a problem is how can I force the user to enter a 6 digit number?

Thanks in advance
JBL



No Name

Force minimum text box entry
 
Try this:

Sub MinTextBoxEntry
If Len(Trim$(TextBox1.Text)) <5 Then
'change the number 5 for the minimum text box length
MsgBox("The repair number must be made before
proceeding!")
end if
End Sub


-----Original Message-----
Hello All,

I have an IsEmpty in my current code that is not working

when tied to a
command button to exit the form.

Private Sub CommandButton7_Click()
'determine which button was selected
With AddNew
Select Case True
Case .OptionButton1.Value:
MsgBox "Calculate Repair Only

Selected"
Case .OptionButton2.Value:
MsgBox "Calculate & Print Repair

Selected"
Case .OptionButton3.Value:
MsgBox "Calculate Repair & Add to

Data File Selected"
End Select
End With
If IsEmpty(AddNew.TextBox38.Value) Then
MsgBox "The repair number must be made before

proceeding!"
Else

MsgBox "The active cell value is OK"
End If
AddNew.MultiPage1.Value = 1
End Sub

Since this is a tabbed form, will this only work on the

complete closure of
the form? It does not make sense.

I also want to verify that the text box entry is numeric

6 digits only. I
have set the text box to Characters 6 in properties, so

I know I can't have
more than 6 characters, and I have the numeric

validation created, what I am
having a problem is how can I force the user to enter a

6 digit number?

Thanks in advance
JBL


.



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com