Force minimum text box entry

  • Thread starter Thread starter JBL
  • Start date Start date
J

JBL

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top