G
Guest
I've got a function that can accept just Alphabet characters but is it a way
to get it to accept special characters like "(" or ")" or "-" or just ablank
space " " here is the code that I'm using that is prove to work on accepting
just alphabet in the text box
'**********************************
'Declarations section of the module
'**********************************
Option Compare Database
Option Explicit
'===============================================================
' The following function is named IsAlpha(). It accepts a string
' argument and returns either True (-1) or False (0).
'===============================================================
Function IsAlpha(MyString) As Boolean
Dim LoopVar As Integer
Dim SingleChar As String
If IsNull(MyString) Then
IsAlpha = False
Exit Function
End If
For LoopVar = 1 To Len(MyString)
SingleChar = Mid$(MyString, LoopVar, 1)
If SingleChar < "A" Or SingleChar > "Z" Then
IsAlpha = False
Exit Function
End If
Next LoopVar
IsAlpha = True
End Function
Can anyone help please?
to get it to accept special characters like "(" or ")" or "-" or just ablank
space " " here is the code that I'm using that is prove to work on accepting
just alphabet in the text box
'**********************************
'Declarations section of the module
'**********************************
Option Compare Database
Option Explicit
'===============================================================
' The following function is named IsAlpha(). It accepts a string
' argument and returns either True (-1) or False (0).
'===============================================================
Function IsAlpha(MyString) As Boolean
Dim LoopVar As Integer
Dim SingleChar As String
If IsNull(MyString) Then
IsAlpha = False
Exit Function
End If
For LoopVar = 1 To Len(MyString)
SingleChar = Mid$(MyString, LoopVar, 1)
If SingleChar < "A" Or SingleChar > "Z" Then
IsAlpha = False
Exit Function
End If
Next LoopVar
IsAlpha = True
End Function
Can anyone help please?