RE: Required Field for 7 Numeric digits only
- From: JLGWhiz <JLGWhiz@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 12:02:01 -0700
You have to be in design mode to access the text box code module. Display
the Control Toolbox toolbar to click the design mode icon.
"LRay67" wrote:
I didn't have my current code when I posed this question. Below is the code.
we are using for this particular textbox. I would like the user to be able
to enter data into the field and upon tabbing or leaving the field verify
that they have 7 numeric digits entered (nothing more or less than that). We
have a message stating that they have to enter if nothing is filled
in.......Any suggestions
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = vbKeyTab Then
If TextBox1 = "" Then
MsgBox "Please enter Accounting Unit Code (7 Digits)"
Application.SendKeys ("{BS}")
TextBox1.Activate
Exit Sub
End If
KeyAscii = 0
TextBox3.Activate
End If
End Sub
"JLGWhiz" wrote:
This should cover it all, needed to make the loop so they have to respond.
RETRY:
UserInput = Application.InputBox("Enter an seven numeric digits", _
"NUMERIC ONLY", Type:=1)
If UserInput = "" Or UserInput = False Or Len(UserInput) <> 7 Then
MsgBox "You must enter numbers only."
GoTo RETRY:
End If
"LRay67" wrote:
I have a required field that can contain only 7 numeric digits within the
textbox. Also want to put in a message box to alert them that this field
must have 7 numeric digits. Any suggestions on how to write the code behind
this? Thanks
Linda
- References:
- Required Field for 7 Numeric digits only
- From: LRay67
- RE: Required Field for 7 Numeric digits only
- From: JLGWhiz
- RE: Required Field for 7 Numeric digits only
- From: LRay67
- Required Field for 7 Numeric digits only
- Prev by Date: Re: Required Field for 7 Numeric digits only
- Next by Date: Re: Required Field for 7 Numeric digits only
- Previous by thread: RE: Required Field for 7 Numeric digits only
- Next by thread: RE: Required Field for 7 Numeric digits only
- Index(es):