shelton1979
MIS
I have a field with the whole name in it with no spaces like Doe,John. I need to have a 2 separate fields in a query: one for the last name and one for the first name. Can anyone help me
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim inp As String
Dim frst As String, lst As String
inp = Source
lst = Left(inp, InStr(1, inp, ",") - 1)
frst = Right(inp, Len(inp) - Len(lst) - 1)
Dim name as Stirng
Dim test1() as String
Dim test2 as String
Dim flag as Boolean
name = "TYLER,JUSTIN DARNELL"
flag = false
test1 = split(name, ",")
if instr(test1(1)," ") > 0 then
test2 = split(test1(1)," ")
flag = true
end if
msgBox "First name = " & test1(0) & " and surname = " & iif(flag,test2(0),test1(1))
name = "TYLER,JUSTIN"