I am Currently making a program so i can enter a name
eg
Joe Bloggs
and switch the names around
eg
Bloggs Jow
Any ideas how to do this i am stuck
I have started of by inputing the name then finding the space.
were do i go from hear or i am i completly on the wrong track
Private Sub cmdSwitch_Click()
namein = txtNameIn
spacepos = InStr(namein, " ")
End Sub
This will work and will help you to understand string functions:
Dim stTitle As String
Dim stFirst As String
Dim stLast As String
'assign the original string
stTitle = "John Smith"
'assign the left part of the string up to the last character before the space
stFirst = Left(stTitle, InStr(stTitle, " ") - 1)
'assign the right part of the string after the space
stLast = Right(stTitle, Len(stTitle) - InStr(stTitle, " "))
'swap the strings around
stTitle = stLast & " " & stFirst
'see what it looks like
MsgBox stTitle