G Guest Jul 25, 2004 #1 Ok, I'm an idiot - in VBA, how do I find the directory that my database is located in? VBA.FileSystem.CurDir$ returns the working directory, which is not the same. Thanks, Gary
Ok, I'm an idiot - in VBA, how do I find the directory that my database is located in? VBA.FileSystem.CurDir$ returns the working directory, which is not the same. Thanks, Gary
K Ken Snell Jul 25, 2004 #2 CurrentProject.Path -- Ken Snell <MS ACCESS MVP> garyfehr said: Ok, I'm an idiot - in VBA, how do I find the directory that my database is Click to expand... located in? VBA.FileSystem.CurDir$ returns the working directory, which is not the same.
CurrentProject.Path -- Ken Snell <MS ACCESS MVP> garyfehr said: Ok, I'm an idiot - in VBA, how do I find the directory that my database is Click to expand... located in? VBA.FileSystem.CurDir$ returns the working directory, which is not the same.
J John Spencer (MVP) Jul 25, 2004 #3 Full path to the file including the name of the database is CurrentDb().Name You can strip the name off the end to get the directory. Since you don't say which version of Access, try Dim strPath as String strPath = currentDb().Name strPath = Left(strPath,Len(strPath)-Len(Dir(StrPath))-1) Adjust the minus one on whether you want to include the final slash or not.
Full path to the file including the name of the database is CurrentDb().Name You can strip the name off the end to get the directory. Since you don't say which version of Access, try Dim strPath as String strPath = currentDb().Name strPath = Left(strPath,Len(strPath)-Len(Dir(StrPath))-1) Adjust the minus one on whether you want to include the final slash or not.