If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
CODE: get current dir of MDB file
I will be posting a few short snippets of code. Many of you coders
already know these, but they should benefit other people as well. Here is code to find the current directory of the MDB file you currently have open. This is useful for saving output files (like report PDFS, text files, etc) to the same dir as your MDB file. It returns the current directory with a trailing backslash. Function CurrentDBDir() As String Dim strDBPath As String Dim strDBFile As String strDBPath = CurrentDb.Name strDBFile = Dir(strDBPath) CurrentDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile)) End Function |
#2
|
|||
|
|||
CODE: get current dir of MDB file
A Man wrote:
I will be posting a few short snippets of code. Many of you coders already know these, but they should benefit other people as well. Here is code to find the current directory of the MDB file you currently have open. This is useful for saving output files (like report PDFS, text files, etc) to the same dir as your MDB file. It returns the current directory with a trailing backslash. Function CurrentDBDir() As String Dim strDBPath As String Dim strDBFile As String strDBPath = CurrentDb.Name strDBFile = Dir(strDBPath) CurrentDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile)) End Function In A2002and later, you can use CurrentProject.Path -- Marsh MVP [MS Access] |
Thread Tools | |
Display Modes | |
|
|