Public Function changeover(curname As String) As String Dim lcNewString, lcNewString1, lcNewString2 lcNewString = curname Select Case lcNewString ' Evaluate New Name. Case InStr(1, lcNewString, "0", 1) > 1 ' We will leave this one alone.... Case InStr(1, lcNewString, " ", 1) < 1 ' This string looks to be all characters... so leave it alone.... Case InStr(1, lcNewString, " ", 1) > 1 ' Okay, if we have more than two spaces, we are in a bit of strife... lcNewString = "***" + lcNewString Case InStr(1, lcNewString, " ", 1) = 1 ' Okay, now we have one space.... so, what do we have as far as ' length of the two strings.... lcString1 = Mid$(1, lcNewString, InStr(1, lcNewString, " ", 1)) lcString2 = Mid$(1, lcNewString, Len(lcNewString) - InStr(1, lcNewString, " ", 1)) ' now, change the positions.... lcNewString = ALLTRIM(lcString2) + ALLTRIM(lcString1) End Select changeover = lcNewString End Function>Hi everyone.... I am trying to write a bit of a function for a module in access; a definate first for me being VFP by trade... :-)
> >Public Function changeover(curname As String) As String >Dim lcNewString, lcNewString1, lcNewString2 > >lcNewString = curname > >Select Case lcNewString ' Evaluate New Name. > > Case InStr(1, lcNewString, "0", 1) > 1 > ' We will leave this one alone.... > Exit Function > Case InStr(1, lcNewString, " ", 1) < 1 > ' This string looks to be all characters... so leave it alone.... > Exit Function > Case InStr(1, lcNewString, " ", 1) > 1 > ' Okay, if we have more than two spaces, we are in a bit of strife... > lcNewString = "***" + lcNewString > Exit Function > Case InStr(1, lcNewString, " ", 1) = 1 > ' Okay, now we have one space.... so, what do we have as far as > ' length of the two strings.... > lcString1 = Mid$(1, lcNewString, InStr(1, lcNewString, " ", 1)) > lcString2 = Mid$(1, lcNewString, Len(lcNewString) - InStr(1, lcNewString, " ", 1)) > ' now, change the positions.... > lcNewString = ALLTRIM(lcString2) + ALLTRIM(lcString1) > Exit Function >End Select > >End Function > >