[英]How to Kill CurrentDB using self executed code
I have been researching ways to self execute code that would delete the current database file.我一直在研究自我执行会删除当前数据库文件的代码的方法。 I came across a code snippet here that does exactly that for Excel, but this does not seem to translate to Access very well.
我在 这里遇到了一个代码片段,它完全适用于 Excel,但这似乎并不能很好地转换为 Access。
Sub KillMeExcel()
With ThisWorkbook
.Saved = True
.ChangeFileAccess Mode:=xlReadOnly
Kill .FullName
.Close False
End With
End Sub
There does not seem to be a .ChangeFileAccess
Mode in Access, so I haven't gotten further than that. Access 中似乎没有
.ChangeFileAccess
模式,所以我没有进一步了解。
Is it possible to delete the current database using VBA code?是否可以使用 VBA 代码删除当前数据库?
I would also be wary of sending an open and running Access database via mail.我也会对通过邮件发送打开和运行的 Access 数据库持谨慎态度。
My workaround would be:我的解决方法是:
Launch an external vbs
DoCmd.Quit
and in the vbs:并在 vbs 中:
That is not possible.那是不可能的。 You will get a Permission Denied error - for a reason.
您将收到Permission Denied错误 - 出于某种原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.