Reputation: 3337
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.
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.
Is it possible to delete the current database using VBA code?
Upvotes: 1
Views: 448
Reputation: 27634
I would also be wary of sending an open and running Access database via mail.
My workaround would be:
Launch an external vbs
DoCmd.Quit
and in the vbs:
Upvotes: 6
Reputation: 55816
That is not possible. You will get a Permission Denied error - for a reason.
Upvotes: 5