Right or Left Question

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

Guest

Hello,

I have a control that references data that looks like this: C:ABC/tuv/Testing

I only want the Testing to show up. But the testing file may be different
names and different lengths. My path is consistently 10 characters. Can
someone please help on this? I assume I need to use left or right with Len,
but I am not very experienced in that.

Thanks much
 
You can do it with the Mid function ...

? Mid$("C:ABC/tuv/Testing", 11)
Testing

If you pass no value for the optional third 'Length' argument of this
function, it reads to the end of the text.
 
I tried this in the control source box, but got an error:

=Mid([mwknif],10)

mwknif is my control source field where my data is.

I'm not sure what your ? and $ are for. Is it necessary syntax?
 
Perhaps the name of the textbox is the same as the name of the field? If so,
you'll need to change the name of the textbox.

When used in the Immediate Window, '?' is shorthand for 'Print' and outputs
the result to the Immediate Window.

Several VBA functions have versions with and without the '$', e.g. Left and
Left$, Right and Right$, Mid and Mid$. The difference is in the data type of
the return value. The version without the '$' returns a Variant, the version
with the '$' returns a String.

If you want all characters after the first ten characters, your starting
character will need to be 11, not 10. Mid([mwknif], 10) will include the
tenth character in the output, e.g. "/Testing" rather than "Testing".

--
Brendan Reynolds
Access MVP


Aaron said:
I tried this in the control source box, but got an error:

=Mid([mwknif],10)

mwknif is my control source field where my data is.

I'm not sure what your ? and $ are for. Is it necessary syntax?

Aaron said:
Hello,

I have a control that references data that looks like this:
C:ABC/tuv/Testing

I only want the Testing to show up. But the testing file may be
different
names and different lengths. My path is consistently 10 characters. Can
someone please help on this? I assume I need to use left or right with
Len,
but I am not very experienced in that.

Thanks much
 
Back
Top