vba 如何找到 MS Access 数据库的当前路径(目录)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28977285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:27:25  来源:igfitidea点击:

How do I find the current path (directory) of a MS Access database?

vbams-accessaccess-vba

提问by WestAce

I am writing VBA within my Access database and I need to reference the containing directory of this database. This path could change since I will be moving the database around.

我正在 Access 数据库中编写 VBA,我需要引用该数据库的包含目录。这个路径可能会改变,因为我将移动数据库。

回答by WestAce

You will want to use the following code:

您将需要使用以下代码:

CurrentProject.Path

This will return a string representing the file path of the current directory.

这将返回一个表示当前目录的文件路径的字符串。