Deleting a Report Before Using TransferDatabase

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using TransferDatabase to import a report from another database. The
report gets named with a 1 on the end. How can I delete the existing report
first to prevent this from happening ? For tables, I use the following code.
Is there an equivalent method for reports ?

For Each tdef In db.TableDefs
If tdef.Name = "TestTable" Then
DoCmd.DeleteObject acTable, tdef.Name
Exit For
End If
Next tdef
 
You are trying to delete a report, and you are calling "TableDefs"? Tables
and reports are two different types of objects.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I was using the code as an example of how I deleted the table. For the
report I could not locate an equivalent for TableDefs i.e. ReportDefs. Could
I simply type the following:

DoCmd.DeleteObject acReport, "TestReport"
 
When I tried it initially, it did not seem to delete the report. I tried it
again and it seems to be working. Thank you.
 
Back
Top