Python脚本打开MS访问并运行宏,找不到文件错误

发布于 2025-01-29 05:40:08 字数 916 浏览 1 评论 0原文

我有与

运行一个保存的MS Access Macro In In In In in https://stackoverflow.com/questions/57374277/57374277/57374277/57374277/57374277/57374277/ Python:错误

我使用完全相同的代码,但使用我的访问文件和宏名称,使用所建议的完整路径,但会遇到相同的错误。

import win32api,time
from win32com.client import Dispatch

strDbName = '\\server\folder\file.accdb'
objAccess = Dispatch("Access.Application")
objAccess.Visible = False
objAccess.OpenCurrentDatabase(strDbName)
objDB = objAccess.CurrentDb()
objAccess.DoCmd.RunMacro('test')
objAccess.Application.Quit()

我的访问存储在我写的网络路径中,

strDbName = '\\server\folder\file.accdb'

我也尝试过

strDbName = 'r\\server\folder\file.accdb'

,但我总是会遇到错误:“ Microsoft Access无法打开数据库,因为它丢失或仅由另一个用户打开,或者不是ADP文件。”

有线索吗?

I have the same exact problem than

Running a saved MS Access macro in python: ERROR

I' using the exact same code but with my Access File and Macro names, using the complete path as suggested but getting the same error.

import win32api,time
from win32com.client import Dispatch

strDbName = '\\server\folder\file.accdb'
objAccess = Dispatch("Access.Application")
objAccess.Visible = False
objAccess.OpenCurrentDatabase(strDbName)
objDB = objAccess.CurrentDb()
objAccess.DoCmd.RunMacro('test')
objAccess.Application.Quit()

My access is stored in a network path that I'm writing like this

strDbName = '\\server\folder\file.accdb'

I have also tried

strDbName = 'r\\server\folder\file.accdb'

but I always get the error "Microsoft Access can't open the database because it is missing, or opened exclusively by another user, or it is not an ADP file."

any clue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文