Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignore Blank/Non-Numeric Input On Form???

Status
Not open for further replies.

JockVSJock

Technical User
Jun 28, 2001
59
US

Created a form and I don't understand how to do the following.

I have a form that has 10 fields and if they DO NOT enter in a number or don't enter anything, it is ignored.

How do I write this in code? I don't want an error messasge either, just ignore blanks and non-numeric entries...See my code below...


If Not IsNumeric(txt1.Text) Or txt1.Text <> &quot;&quot; Then
'what do I put here?
else if
If Not IsNumeric(txt2.Text) Or txt2.Text <> &quot;&quot; Then
'what do I put here?
else if
If Not IsNumeric(txt3.Text) Or txt3.Text_
<> &quot;&quot; Then



Get what I am trying to do?


thanks


 
I'm assuming you only want to process numbers?

Dim ctrl as Control
For Each ctrl in Controls
If TypeOf ctrl is TextBox then
If IsNumeric(ctrl.text) Then
'process the information in the Textbox
End If ' if it's not a number it's ignored
End If
Next ctrl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top