Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A beggining function....
Message
From
03/04/2002 19:00:06
 
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
A beggining function....
Miscellaneous
Thread ID:
00640655
Message ID:
00640655
Views:
41
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... :-)

Anyway, I have a macros which will call this function (I hope)... and get it to look for spaces in a name field.... if it finds a space, it should parse the name field into two sets... and then put them back together in revers order???

This code is patterned off of a VFP method, kind of... lol... so, does it look right?? and if it is (highly unlikely)... how do I return the lcNewString back to the update query??? I am way out of my area on this one.... so a HUGE TIA for some help....


Ric
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
Next
Reply
Map
View

Click here to load this message in the networking platform