tags:

views:

72

answers:

2

I don't know anything about VBA but I need to get the file name out of a file full path.

So for a string like "c:\something\somethingelse\file.name" I need to get "file.name" out. Also how can you get a quote in a string such as " " "? backslash doesn't seem to work.

+5  A: 

To get a quote in a string use two quotes ("")

To find the location of the slash from the end, use InstrRev()

Jon B
Thanks Jon B. Is there a substring equivalent as well?
Tom
@Tom that would be InStr()
Jon B
Jon, well, I'll be darned. I actually learned one useful thing this year. I had no idea that InstrRev existed. Ah, I see it is new in Access 2000.
Tony Toews
@Tony Toews: Open the Visual Basic Editor. From the menu, choose: View, Object Browser. Change the dropdown from 'All Libraries' to 'VBA'. For each module and class, study every function and learn what it does. Advance class: learn which functions can be used in Access Database Engine SQL outside of the Access UI.
onedaywhen
John, this seems to be a correct and acceptable answer. You might considering accepting it.
Oorang
A: 

the DIR() function will return the filename. You need to add a reference to the Microsoft Scripting runtime.

Harry
Why would you do that (add the overhead of the entire scripting runtime) when you can simply use built-in string functionality?
Ken White