Help with file names and paths

adambedford

Registered User.
Local time
Today, 18:02
Joined
Apr 15, 2009
Messages
42
I have this code snippet that extracts on the file name from a string. It does this by removing everything left of the first "\" (working from right to left).

Code:
    Dim I As Integer
    For I = Len(FullName) To 1 Step -1
        If Mid(FullName, I, 1) = "\" Then
            ExtractName = Right(FullName, Len(FullName) - I)
            Exit For
        End If
    Next

How would I change the code to only remove the CurrentProject.Path so I can store values containing backslashes.

The code is for a photo browse application and I need to be able to reference folders within the database folder.

Thanks, Adam
 
have you tried the split function?
 
how do i do that?

sorry, I'm new to all this!
 
Hello Adam! I think I got what you want.
I don't know if its the best way to do it but, I built a function that gives you the path of the file relatively to the CurrentProject.Path.
I had the example of the DB you uploaded in other post, so I added a Module with that function to the DB and created a form with a textbox that runs the Function with a double click.
I hope it will help. Cheers!
 

Attachments

Adam, you are double posting, this will result in conflicting answers. Please refrain from doing this and stick to one post. Only create a new thread if it is a new question.

David
 
Hi jardiamj!,

Thank you once again for your help. One question...how would I get that code to work with my existing Case statements on the frmVillas? Also, would it be possible to quickly explain what the getRelPath Function is doing?

Thanks!
 

Users who are viewing this thread

Back
Top Bottom