Why won't INSTR() work!!??? 
Author Message
 Why won't INSTR() work!!???

Why won't this work? For fldDonorPrefix(snewname4) I get "r. and M" or "s."
instead of "Mr. and Mrs.". Why?

 If rsCurrent.RecordCount > 0 Then
    Do While Not rsCurrent.EOF

        wsCurrent.BeginTrans
        sNewName3 = rsCurrent!fldNameLineOne
        sNewName4 = rsCurrent!fldDonorPrefix

        For istep = 1 To 9
        Select Case istep
                Case Is = 1
                sSearchCharSub = "Mr. and Mrs."
                Case Is = 2
                sSearchCharSub = "Ms."
                Case Is = 3
                sSearchCharSub = "Miss"
                Case Is = 4
                sSearchCharSub = "Mr."
                Case Is = 5
                sSearchCharSub = "Dr."
                Case Is = 6
                sSearchCharSub = "Mrs."
                Case Is = 7
                sSearchCharSub = "Col."
                Case Is = 8
                sSearchCharSub = "Lt."
                Case Else
                sSearchCharSub = "Mrs"
                End Select

        iNameLengthSub = Len(sNewName3)
        iFoundSub = InStr(sNewName3, sSearchCharSub)

                Do While iFoundSub <> 0
                        sFirstPartSub = Left(sNewName3, iFoundSub)
                        sSecondPartSub = Right(sNewName3, (iNameLengthSub -
iFoundSub))
                        sNewName4 = sFirstPartSub
                        sNewName3 = sSecondPartSub

                    iNameLengthSub = Len(sNewName3)
                    iFoundSub = InStr(sNewName3, sSearchCharSub)

        Loop
            Next istep
            rsCurrent.Edit
            rsCurrent!fldNameLineOne = LTrim(sNewName3)
            rsCurrent!fldDonorPrefix = RTrim(sNewName4)
            rsCurrent.UPDATE
            rsCurrent.MoveNext
            wsCurrent.CommitTrans
        Loop

   End If

End Sub

--
S.E. Hanley

Applications Programmer
Callaway Gardens
Pine Mtn. GA



Fri, 16 Jun 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Why doesn't this InStr syntax work?

2. Why doesn't this InStr work?

3. Why doesn't this InStr Syntax work?

4. Two Q's [Closing a file][why won't work]

5. Why won't this work?

6. Why won't this work?

7. Q: Why won't this work

8. Why won't AllowZeroLength work?

9. Why won't this work?

10. Why won't this work

11. Why won't this work?

12. Why won't this work right

 

 
Powered by phpBB® Forum Software