[Edited by Judd on 07-05-2000 at 06:16 AM]Code:Public Function ValidateString(ByVal strTest As String, ByVal MaxChars As Integer) As Boolean ValidateString = True If Len(strTest) > MaxChars Then ValidateString = False MsgBox "String cannot exceed " & MaxChars & " characters" Exit Function End If For i = 1 To Len(strTest) j = Mid(strTest, i, 1) Like "[!ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789()_]" If j Then ValidateString = False MsgBox "Name contains invalid characters" Exit Function End If Next i End Function





Reply With Quote