Due to the use of multiple folders to set up the albums needed for this photo directory, I need to retreive the entire path all the way to FileFolder which ends with "Images\". Since the backslash is in all likelihood not the last one in the path name, I need to know how to rewrite the mid or instr functions to accomidate this.
Reply from Richard Rost:
You can start from the end of the string containing the path/filename to isolate just the pathname. I would start a loop that looks for that last backslash. Let's say you have:
S = "C:\Users\Richard\Images\something.jpg"
X = len(S) While X > 0 and mid(S,X,1)<>"\" X = X - 1 Wend
Now you have the position of the last "\" in the string. At this point you can cut off the filename, which you can do with:
S = left(S,X)
Now you have just:
S = "C:\Users\Richard\Images\"
If you want to get what's BEFORE the Images\ folder, you can now just chop that off:
S = Left(S,Len(S)-7)
Since you know that "Images\" is 7 characters. Now you're left with:
S = "C:\Users\Richard\"
Hopefully this is what you're trying to find. Now, I haven't fully tested this (it's off the top of my head) and I didn't add any error handling (what if there are no \ in the string?) but it should get you started.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Imaging Seminar.