= Replace(Left({name}, Len({name} - 2), " ")
Assuming the data will always be in that format, try
This would strip off the last two characters in each case and then remove the space between the comma and the first name.Code:= Replace(Left({name}, Len({name} - 2), " ")
select LAST, IIF(instr([FIRST]," ")>0,left([FIRST],instr([FIRST]," ")-1),[FIRST]) as FirstNam
from table
Did you leave the {} brackets in? They were just to indicate a general name and should be removed from the actual query.I changed the name to my column name 'CustomerName' and it gives me error as:
the exprerssion you entered has a function containing the wrong number of arguments
Did you leave the {} brackets in? They were just to indicate a general name and should be removed from the actual query.
What's the full query into which you placed that line?
Sorry, I misread the question and assumed you had written a query to start with and just wanted help getting it working. That's just the part to convert the name into the format you want. In order to create the query itself you need to format it as Ranman256 did. e.g.Replace(Left([CustomerName], Len([CustomerName] - 2, " ")
SELECT Replace(Left([CustomerName], Len([CustomerName] - 2, " ") FROM {table name};
Sorry, I misread the question and assumed you had written a query to start with and just wanted help getting it working. That's just the part to convert the name into the format you want. In order to create the query itself you need to format it as Ranman256 did. e.g.
Code:SELECT Replace(Left([CustomerName], Len([CustomerName] - 2, " ") FROM {table name};
I thin there's a bracket missing after the 2. Try
Code:Select Replace(Left([CustomerName], Len([CustomerName] - 2), " ") from CommentItem