InStrRev not working

G

Guest

I am using Access 2002 (XP).

I have entered a simple formulat in a query:

InStrRev([Contact], " ")

But, the funtion is not reading from right to left, but rather it is acting
just like the InStr function. I have tried searching for other characters
and no matter what this function searches from left to right instead of right
to left.

I have used this function for years and never had this problem. Is this new
or common. Any solutions out there.

Thanks,

Seth
 
W

Wayne Morgan

Can you give us an example of what you're getting?

?InStrRev("HELLO", "L")
4

As you can see, it found the first L from the reverse position 4. The 4 is
counted from the left, but the first L found is the one found when searching
from the end.
 
G

Guest

In the past with every version of Access I have used the following example
would happen:

InStrRev("the dog ran quickly through the woods", " ")

it would return 6

But in 2002 it seems to return 32.

It used to read from right to left, but now it returns the position of the
last occurence of the searched for character in the string from the left.
The way it appears to be working is just as the Object Browser said it should
work. However, I am certain that is not how it has always worked.

The first occurence from the right and the last occurence from the left
clearly do not return the same integer value. Once I figured this out I was
able to complete my job, but I am still certain that this is not how this
function has worked in the past.

Seth

Wayne Morgan said:
Can you give us an example of what you're getting?

?InStrRev("HELLO", "L")
4

As you can see, it found the first L from the reverse position 4. The 4 is
counted from the left, but the first L found is the one found when searching
from the end.

--
Wayne Morgan
MS Access MVP


Seth Schwarm said:
I am using Access 2002 (XP).

I have entered a simple formulat in a query:

InStrRev([Contact], " ")

But, the funtion is not reading from right to left, but rather it is
acting
just like the InStr function. I have tried searching for other characters
and no matter what this function searches from left to right instead of
right
to left.

I have used this function for years and never had this problem. Is this
new
or common. Any solutions out there.

Thanks,

Seth
 
W

Wayne Morgan

If I remember correctly, this function first appeared in 2000, but it may
have been 2002. If you were using it before then, it would have been a "user
defined function". If you upgraded the database from the previous version,
this function would have also been propagated and may have taken precedence
over the built-in function.

--
Wayne Morgan
MS Access MVP


Seth Schwarm said:
In the past with every version of Access I have used the following example
would happen:

InStrRev("the dog ran quickly through the woods", " ")

it would return 6

But in 2002 it seems to return 32.

It used to read from right to left, but now it returns the position of the
last occurence of the searched for character in the string from the left.
The way it appears to be working is just as the Object Browser said it
should
work. However, I am certain that is not how it has always worked.

The first occurence from the right and the last occurence from the left
clearly do not return the same integer value. Once I figured this out I
was
able to complete my job, but I am still certain that this is not how this
function has worked in the past.

Seth

Wayne Morgan said:
Can you give us an example of what you're getting?

?InStrRev("HELLO", "L")
4

As you can see, it found the first L from the reverse position 4. The 4
is
counted from the left, but the first L found is the one found when
searching
from the end.

--
Wayne Morgan
MS Access MVP


Seth Schwarm said:
I am using Access 2002 (XP).

I have entered a simple formulat in a query:

InStrRev([Contact], " ")

But, the funtion is not reading from right to left, but rather it is
acting
just like the InStr function. I have tried searching for other
characters
and no matter what this function searches from left to right instead of
right
to left.

I have used this function for years and never had this problem. Is
this
new
or common. Any solutions out there.

Thanks,

Seth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top