In the directory where Access gets the program and the full name

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.