Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A beggining function....
Message
 
To
03/04/2002 19:00:06
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640655
Message ID:
00640673
Views:
11
This message has been marked as a message which has helped to the initial question of the thread.
To return the value, simply assigned the value to the name of your function this way:
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... :-)
>
>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
>
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform