Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Force entry in one cell due to the value in the other | Excel Worksheet Functions | |||
Validation - Force entry from drop down list | Excel Discussion (Misc queries) | |||
Force an entry | Excel Discussion (Misc queries) | |||
Validation to force entry in a cell | Excel Worksheet Functions | |||
Force entry to one of three cells | Excel Worksheet Functions |