built-in functions

  • Thread starter djbiehl via AccessMonster.com
  • Start date
D

djbiehl via AccessMonster.com

I have the following external VBA function that I use in queries to get a
field name from a path. The function is as follows:

Public Function fieldName(fullPath As String)
fieldName = Right(fullPath, Len(fullPath) - InStrRev(fullPath, "\"))
End Function

The fullPath argument basically looks like this:
tablename\fieldname\different_table\different_field\another_table\
another_field

....and can have a varying number of tables and fields from:
table\field

to:
table\field\table\field\table\field\table\table\field\table\field

etc etc etc.

So basically the function that I have returns the rightmost field, aka:
whatever lies after the last "\"

I need to produce the same result without using my own function; Only using
Access' built in functions. However, there isn't an InStrRev function built
into access, only VBA. Does anyone know of a way to produce this same result
only using Access' built in functions?
 
M

Marshall Barton

djbiehl said:
I have the following external VBA function that I use in queries to get a
field name from a path. The function is as follows:

Public Function fieldName(fullPath As String)
fieldName = Right(fullPath, Len(fullPath) - InStrRev(fullPath, "\"))
End Function

The fullPath argument basically looks like this:
tablename\fieldname\different_table\different_field\another_table\
another_field

...and can have a varying number of tables and fields from:
table\field

to:
table\field\table\field\table\field\table\table\field\table\field

etc etc etc.

So basically the function that I have returns the rightmost field, aka:
whatever lies after the last "\"

I need to produce the same result without using my own function; Only using
Access' built in functions. However, there isn't an InStrRev function built
into access, only VBA. Does anyone know of a way to produce this same result
only using Access' built in functions?


InStrRev is a built in function, it works fine for me in
A2003. If you can not use it in a query, I think it might
be because you are using A2000 without the latest Service
packs. I never used A2000, but I believe this issue was
rectified at some point after the initial release.
 

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