Hi Guy's what am I doing wrong here, I am trying to get either Forename only (Joe) or if the title <> "" then I am trying to get title and surname (Mr Bloggs)
The MsgBox is blank
Code:
Dim MyStr As String, fName As String, SName As String, mHello as String
If Me.txtClientName <> "" Then
If Me.cboClientTitle = "" Then
MyStr = InStr(Me.txtClientName, " ")
fName = Left(Me.txtClientName, MyStr) 'Forename
SName = Right(MyStr, MyStr) 'Surname
mHello = fName
Else
fName = ""
SName = ""
End If
End If
If Me.txtClientName <> "" Then
If Me.cboClientTitle <> "" Then
MyStr = InStr(Me.txtClientName, " ")
fName = Left(Me.txtClientName, MyStr) 'Forename
SName = Right(MyStr, MyStr) 'Surname
mHello = Me.cboClientTitle & " " & SName
Else
fName = ""
SName = ""
End If
End If
MsgBox (mHello)