Access Query Specific Character String Select

D

DJohn22

I have two tables in my database. TableA has a field that contains
filenames only. TableB has a field that contains the full path and
filename. In my query, I would like to create an expression that
extracts the filename from the field in TableB and compare it to the
filename field in TableA and show only those with matches.
I am sure it can be done using an InStr function with the Right
function. What I do not know how to do is to tell it to go right until
it hits the first backslash (\).

Can anyone help?
 
G

Guest

You can return the file name from the full path using a combination of the
Mid$ and InstrRev functions:

Mid$(strPath,InstrRev(strpath,"\")+1)

The Dir function will also do it, but that's inefficient as it involves a
disk access each time.

Ken Sheridan
Stafford, England
 

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

Similar Threads


Top