Rght Function?

D

D

Hi:

I have a concatenated field separated by |, I need the last four numeric
characters after the |; sometimes is not numeric;

Can I use the above function; is there another way

Thanks,

Dan
 
K

KARL DEWEY

Can I use the above function
Why bother to ask if you can use the function -- just TRY IT!
 
D

D

Hi Karl:

I would like to get just the numeric characters after the last |; the RIGHT
([f],4) does not get the wanted result, in many cases...

Thanks,

Dan
 
J

Jeff Boyce

Take a look at the Instr() function. It would give you the location, in
your string, of the symbol you designate.

Regards

Jeff Boyce
Microsoft Office/Access MVP


D said:
Hi Karl:

I would like to get just the numeric characters after the last |; the
RIGHT
([f],4) does not get the wanted result, in many cases...

Thanks,

Dan

KARL DEWEY said:
Why bother to ask if you can use the function -- just TRY IT!
 
J

John Vinson

Hi:

I have a concatenated field separated by |, I need the last four numeric
characters after the |; sometimes is not numeric;

Can I use the above function; is there another way

Thanks,

Dan

Well, you certainly cannot use the function named Rght, since there is
no such function.

I don't understand the question very well. You need the last four
numeric characters after the | but sometimes they are not numeric.
What do you want if they're not? Could you post some examples of the
data that you have, and what result you want?

You can *try*

Mid([fieldname], InStr([fieldname], "|") + 1)

to get the entire remainder of the field after the first |; or

Right([fieldname], 4)

to get the last four characters in the field, whether or not there is
a | in the field; or various other substring operations, if they're
needed.

John W. Vinson[MVP]
 
D

D

Mid function is working; the Rght was a typing mistake...

Thanks,

Dan



John Vinson said:
Hi:

I have a concatenated field separated by |, I need the last four numeric
characters after the |; sometimes is not numeric;

Can I use the above function; is there another way

Thanks,

Dan

Well, you certainly cannot use the function named Rght, since there is
no such function.

I don't understand the question very well. You need the last four
numeric characters after the | but sometimes they are not numeric.
What do you want if they're not? Could you post some examples of the
data that you have, and what result you want?

You can *try*

Mid([fieldname], InStr([fieldname], "|") + 1)

to get the entire remainder of the field after the first |; or

Right([fieldname], 4)

to get the last four characters in the field, whether or not there is
a | in the field; or various other substring operations, if they're
needed.

John W. Vinson[MVP]
 
J

John Nurick

Hi Dan,

I would like to get just the numeric characters after the last |; the RIGHT
([f],4) does not get the wanted result, in many cases...

You need to be more precise about exactly what you want. In your first
message you said "the last four numeric characters after the |", and now
you say "just the numeric characters after the last |". For a computer,
these are quite different.

Here are some examples of how a string might end. Can you tell us
exactly what what result you want from each?

....abc|1234
....abc|123
....abc|12345
....abc|12,234
....abc|A1234
....abc|123A4
....abc|
....abc|the 1234 cat sat on the mat
....abc|1 the 2 cat 3 sat 4

Alternatively, please show us the forms your data can actually take and
the results you want.
 
L

Linc

Hi D,

I think the function you are looking for is the Split() function.

The Split function will split your string at every "l" . It will store each
part of the split in an array that you can then assign to a variable.

For example (if I remember right):

We want to split xxxxxxl#### and keep ####

Dim NewString as String

Dim str() as String
str = Split(text, "l")

NewString = str(1) - in Base 0 or str(2) in Base 1

Hope this helps.



D said:
Mid function is working; the Rght was a typing mistake...

Thanks,

Dan



John Vinson said:
Hi:

I have a concatenated field separated by |, I need the last four numeric
characters after the |; sometimes is not numeric;

Can I use the above function; is there another way

Thanks,

Dan

Well, you certainly cannot use the function named Rght, since there is
no such function.

I don't understand the question very well. You need the last four
numeric characters after the | but sometimes they are not numeric.
What do you want if they're not? Could you post some examples of the
data that you have, and what result you want?

You can *try*

Mid([fieldname], InStr([fieldname], "|") + 1)

to get the entire remainder of the field after the first |; or

Right([fieldname], 4)

to get the last four characters in the field, whether or not there is
a | in the field; or various other substring operations, if they're
needed.

John W. Vinson[MVP]
 
Top