instrrev giving error data

alcifer_c

Registered User.
Local time
Today, 10:05
Joined
Jun 3, 2002
Messages
42
Okay, I figured out that I can use the instrrev function to look at data from right to left.

I used this function:

Right([mydata], InStrRev(1, [Mydata], "-"))

in a query in an attempt to get all data right of the "-".

When I run my query, I get "error" instead of the data I was expecting.

What is wrong with the function? BTW i am using Access 2002.

TX
Al
 
Not giving the right data

As suggested, I used:

Right([mydata], InStrRev([Mydata], "-"))

but this doesn't work... just seems to randomly cut off the data without rhyme or reason (can't figure out a pattern).

I tried

Left([mydata], InStrRev([Mydata], "-"))

and it shows the data that I want cut off. Works perfectly if that is what I wanted, but I guess I need the exact opposite. The stuff that is showing to be eliminated.
 
You need to subtract the position of the "-" from the entire length of the string:

Right([YourField],Len([yourfield])-InStrRev([YourField],"-"))
 
Eureka!!

Thank you, thank you... works like a charm, and I actually understand it too.
 

Users who are viewing this thread

Back
Top Bottom