In Access programming, you often need to get the directory and full name of the program, and the following methods can do this.
However, it should be noted that CurrentProject and CodeProject are not suitable for Access97 and previous versions.
In addition, attention should be paid to the difference between CurrentProject and CodeProject
In general, if your MDB or ADP uses only one file, both refer to the same object. But if your MDB references another MDE file. And this code is executed in an MDE, then CurrentProject refers to your first mdb,codeproject referring to the MDE file you are referencing. This feature is used in multiple modules, Universal module root is very good, I use it in the development of enterprise management system, so that multiple MDE files can be used to separate the implementation of different functions, and each MDE can be combined into a powerful system (such as ERP).
For detailed MDE mutual invocation and if cross-mde, lateral MDE, superior and subordinate MDE call forms and reports to each other method, you can email me: tmtony@21cn.com for further explanation
? CurrentProject.FullName
D:frontaccesstmtonyAboutPath.mdb
? CurrentProject.Name
tmtonyAboutPath.mdb
?CurrentProject.Path
D:frontaccess
?Currentdb.Name
D:frontaccesstmtonyAboutPath.mdb
?Codeproject.Name
tmtonyAboutPath.mdb
? CodeProject.FullName
D:frontaccesstmtonyAboutPath.mdb
? CodeProject.path
D:frontaccess
Read the names of individual objects
dim obj as AccessObject
for all obj in Currentproject.alldataaccesspages
Debug.Print Obj. Name
Next obj
for all obj in currentproject.allforms
Debug.Print obj. Name
Next obj
for all obj in Currentproject.allmacros
Debug.Print obj. Name
Next obj
for all obj in Currentproject.allmodules
Debug.Print obj. Name
Next obj
for all obj in Currentproject.allreports
Debug.Print obj. Name
Next obj