Hi John,
I went old school and drew a flow chart of how I think your textbox validation function works, like I was taught when I was a wee young boy (see attached pdf and see if you agree). From further reading it appears functions don't always have to return values. I'm ashamed to say that I never considered using the AfterUpdate event
. I used Exit events but had problems. This is the best solution I've come across for textbox validation. I never thought of Mid/InStr/While combination. This will help me with my hydrology project at work. 
Paxton
Private Sub TextBox_r_AfterUpdate()
Dim txtValue As Variant
If Val(Me.TextBox_r.Value) < 0 Or Val(Me.TextBox_r.Value) > 1 Then
MsgBox Me.TextBox_r.Name & " Value must be > 0 and less < 1"
Me.TextBox_r.Value = ""
Me.TextBox_r.SetFocus
Exit Sub
End If
txtValue = Me.TextBox_r.Value
Call NumberVal(txtValue)
If Numeric = False Then
Me.TextBox_r.Value = ""
Me.TextBox_r.SetFocus
Exit Sub
Else
End If
End Sub
Public txtValue As Variant
Public Numeric As Boolean
Option Explicit
Function NumberVal(txtValue) As Boolean
Dim LPos As Integer
Dim LChar As String
Dim LValid_Values As String
LPos = 1
LValid_Values = " .0123456789"
While LPos <= Len(txtValue)
LChar = Mid(txtValue, LPos, 1)
If InStr(LValid_Values, LChar) = 0 Then
Numeric = False
Exit Function
End If
LPos = LPos + 1
Wend
Numeric = True
End Function
Bookmarks