MrMajik
IS-IT--Management
- Apr 2, 2002
- 267
I figured out how to get all of the reports in my db by name but I can't figure out how to use VB code to delte a report. Here is how I am locating them:
This loops through every report in my database looking for a report called "Report1":
Dim rprtObj As AccessrprtObject, dbs As rprtObject
Set dbs = Application.CurrentProject
' Search for rprtObjects in AllReports collection.
For Each rprtObj In dbs.AllReports
Select Case rprtObj.Name
Case "Report1"
DoCmd.OpenReport "Report1", acViewDesign
' put delete code here...
End Select
Next rprtObj
I use the DoCmd to open the report in design mode hoping I could delete it once VB could see it but I just don't see how to delete it.
Do you know how to delete a report using VB code?
Thank you.
This loops through every report in my database looking for a report called "Report1":
Dim rprtObj As AccessrprtObject, dbs As rprtObject
Set dbs = Application.CurrentProject
' Search for rprtObjects in AllReports collection.
For Each rprtObj In dbs.AllReports
Select Case rprtObj.Name
Case "Report1"
DoCmd.OpenReport "Report1", acViewDesign
' put delete code here...
End Select
Next rprtObj
I use the DoCmd to open the report in design mode hoping I could delete it once VB could see it but I just don't see how to delete it.
Do you know how to delete a report using VB code?
Thank you.