File Path Clarification

mtagliaferri

Registered User.
Local time
Today, 20:31
Joined
Jul 16, 2006
Messages
550
I am getting confused with two codes to add a file path to a record. both work perfectly but which one would be best practice...
To understand in details the DB will be always saved in one folder and inside the folder there will be multiple subfolders the main folder is more likely to be saved in the user "Documents" Folder.
So which is best and pros and cons?

Code:
fDialog.InitialFileName = Environ("userprofile") & "\Documents\BA Cityflyer\Crew Scheduler\Documentation\Crew ID Photos\jpg"

Or

Code:
fDialog.InitialFileName = CurrentProject.Path & "\Documentation\Crew ID Photos\Jpg"

Thanks
 
I would use the second. The first assumes the file is in the user's documents folder, which you've said may not always be the case (I think). The second will use the location where the db is, which seems more appropriate based on your description.
 
debug.print Left(Application.CurrentProject.Path, InStrRev(Application.CurrentProject.Path, "\"))

I am creating many MSAccess Applications that use SQL Server, Excel Object Model Programming, Excel Templates, output folders (for Excel), ....
One folder has sub folders with each of these.
The MSAccess discovers its location, goes up one folder then uses a relative location to run the entire project.
Hope that helps.
 

Users who are viewing this thread

Back
Top Bottom