I am curious to know if case is always disregarded in string comparison as I have used it in the code below. In testing this code, I found that "S" was matched with "s". Version is Access 2003.
Function Voice_Change(inText As String) As Integer
'voice to be changed if inText contains <michael> or <michelle> or <sam>
Dim vFlagStart As Integer, vFlagEnd As Integer
Dim voiceCode As Integer
Dim targetVoice As String
vFlagStart = InStr(inText, "<")
vFlagEnd = InStr(inText, ">")
If vFlagStart > 0 And vFlagEnd > vFlagStart Then
targetVoice = Mid(inText, vFlagStart, (vFlagEnd - vFlagStart) + 1)
Select Case targetVoice
Case Is = "<michael>"
voiceCode = 1
Case Is = "<michelle>"
voiceCode = 2
Case Is = "<sam>"
voiceCode = 3
voiceCode = 0
Voice_Change = voiceCode
Last edited by JerryDal; 04-16-10 at 10:22.
Reason: function return statement changed to "Voice_Change"