I am showing my users a report (rptAnimations) which displays the data in a table (tblAnimationReport). I want to delete the table on Report_Close. I've tried using DoCmd.DeleteObject, but I get the following message:
Run-time Error '3211':
The database engine could not lock table 'tblAnimationReport' because it is already in use by another person or process.
Here is my code:
Code:
Private Sub Report_Close()
DoCmd.DeleteObject acTable, "tblAnimationReport"
End Sub
The tblAnimationReport is created using a Make Table query. Here is the code related to the control which runs that query and displays the report off a button control on a form.
Code:
Sub Command9_Click()
DoCmd.OpenQuery "qryMakeAnimationReport", acViewNormal, acEdit
DoCmd.Close acForm, "frmMakeAnimationReport"
DoCmd.OpenReport "rptAnimationReport", acViewPreview
End Sub
Let me know if you need more information. Thanks in advance.