Trim Statements

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

I would like to have both these expressions to either come
to a blank or a comma and return an the first string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")-1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")-1)
 
Um (air coding),

Left(Names, IIf(instr(names,",")>0, instr(names,","),instr(names," "))-1)

It will fail when both comma and space are absent, of course, as will
you original two formulas.
I would like to have both these expressions to either come
to a blank or a comma and return an the first string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")-1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")-1)
 
Ok, how would I code if I only wanted John to show up.

Say the fields could be:
John, Doe
John
John Doe
How would I code this? I just want the first string and
nothing else

Thanks, Kim

-----Original Message-----
Um (air coding),

Left(Names, IIf(instr(names,",")>0, instr(names,","),instr (names," "))-1)

It will fail when both comma and space are absent, of course, as will
you original two formulas.
I would like to have both these expressions to either come
to a blank or a comma and return an the first string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")-1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")-1)
 
IIF(Instr(Names," ")>0,LEFT(Names,Instr(Names," ")-1),
Instr(Names,",")>0,LEFT(Names,Instr(Names,",")-1),
Names )
Ok, how would I code if I only wanted John to show up.

Say the fields could be:
John, Doe
John
John Doe
How would I code this? I just want the first string and
nothing else

Thanks, Kim
-----Original Message-----
Um (air coding),

Left(Names, IIf(instr(names,",")>0, instr(names,","),instr (names," "))-1)

It will fail when both comma and space are absent, of course, as will
you original two formulas.
I would like to have both these expressions to either come
to a blank or a comma and return an the first string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")-1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")-1)
 
It says I have too many arguments.
-----Original Message-----
IIF(Instr(Names," ")>0,LEFT(Names,Instr(Names," ")-1),
Instr(Names,",")>0,LEFT(Names,Instr(Names,",")-1),
Names )
Ok, how would I code if I only wanted John to show up.

Say the fields could be:
John, Doe
John
John Doe
How would I code this? I just want the first string and
nothing else

Thanks, Kim
-----Original Message-----
Um (air coding),

Left(Names, IIf(instr(names,",")>0, instr
(names,","),instr
(names," "))-1)
It will fail when both comma and space are absent, of course, as will
you original two formulas.

Kim wrote:

I would like to have both these expressions to either come
to a blank or a comma and return an the first string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")- 1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")- 1)
.
 
Whoops! Forgot the second IIF.

IIF(Instr(Names," ")>0,LEFT(Names,Instr(Names," ")-1),
IIF(Instr(Names,",")>0,LEFT(Names,Instr(Names,",")-1),
Names ))



It says I have too many arguments.
-----Original Message-----
IIF(Instr(Names," ")>0,LEFT(Names,Instr(Names," ")-1),
Instr(Names,",")>0,LEFT(Names,Instr(Names,",")-1),
Names )
Ok, how would I code if I only wanted John to show up.

Say the fields could be:
John, Doe
John
John Doe
How would I code this? I just want the first string and
nothing else

Thanks, Kim

-----Original Message-----
Um (air coding),

Left(Names, IIf(instr(names,",")>0, instr (names,","),instr
(names," "))-1)

It will fail when both comma and space are absent, of
course, as will
you original two formulas.

Kim wrote:

I would like to have both these expressions to either
come
to a blank or a comma and return an the first
string "John"

How can I combine these two statements as an expression?

Original Entry in [Names]: "John Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names]," ")- 1)

Original Entry in [Names]: "John, Doe"
Returned by Expression: John
Expression: Expr: Left([Names],InStr(1,[Names],",")- 1)
.
 
Back
Top