Please help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I wanted to change this is a Left, what would the code
change to?

Expr: Right(Trim([City]),Len(Trim([City]))-InStr(1,
[City]," "))
 
Change to Left doesn't tell us anything.....do you want the same number of
characters as this expression is returning? or something else?
 
If I wanted to change this is a Left, what would the code
change to?

Expr: Right(Trim([City]),Len(Trim([City]))-InStr(1,
[City]," "))

ummm... change the word Right to Left?

What's the contents of the field City, and what do you want to see?
What if the city name contains a blank as part of the name (Los
Angeles, Salt Lake City)?
 
This is what the contents look like:

White Plains, City of
Buffalo
NULL
White Plains

I want it to return:

White Plains
Buffalo
NULL
White Plains

I want the expression:

If it comes to a comma replace the field with the first
string

If it comes to a blank and the next space is blank replace
the field with the first string

If the field is empty replace with NULL

If the string comes to a blank and the next space is a
character replace with string 1 and 2.

Is this possible?

-----Original Message-----
If I wanted to change this is a Left, what would the code
change to?

Expr: Right(Trim([City]),Len(Trim([City]))-InStr(1,
[City]," "))

ummm... change the word Right to Left?

What's the contents of the field City, and what do you want to see?
What if the city name contains a blank as part of the name (Los
Angeles, Salt Lake City)?


.
 
On Fri, 30 Jan 2004 05:18:05 -0800,

I think you may need to run this as (probably three) update queries
run separately, since the expression which will edit a string
containing a comma will cause an error if there is no comma.
If it comes to a comma replace the field with the first
string

This is easy by itself. Use a criterion of

LIKE "*,*"

to select only cities where ther is a comma.

The InStr() function returns an integer, the position of its second
string argument within the first argument - i.e.

InStr("abcdef", "c")

returns 3 because c is the third character. So you can use InStr to
find the position of the comma. The function Left(string, n) will
return the leftmost n bytes of string. So:

Left([City], InStr([City], ",") - 1)

will find the first comma in City - let's say that's the 10th byte;
subtract 1 to backspace over the comma, and return the leftmost 9
bytes.
If it comes to a blank and the next space is blank replace
the field with the first string

Same thing: exept use " " (a string constant containing exactly two
blanks) in place of ",".
If the field is empty replace with NULL

These are already null; you don't need to do anything with these
records at all.
If the string comes to a blank and the next space is a
character replace with string 1 and 2.

And that I do not understand. What's an example?
 
Back
Top