Deleting a Report Before Using TransferDatabase

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
 
J

Jeff Boyce

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
 
G

Guest

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"
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top