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 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
[quoted text clipped - 9 lines]
> End If
> Next tdef
rmcompute - 20 Jun 2007 23:29 GMT
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"
> You are trying to delete a report, and you are calling "TableDefs"? Tables
> and reports are two different types of objects.
[quoted text clipped - 17 lines]
> > End If
> > Next tdef
Jeff Boyce - 21 Jun 2007 00:08 GMT
What happens when you try that?
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.
[quoted text clipped - 26 lines]
>> > End If
>> > Next tdef
rmcompute - 28 Jun 2007 23:28 GMT
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.
> What happens when you try that?
>
[quoted text clipped - 33 lines]
> >> > End If
> >> > Next tdef