Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete report 1

Status
Not open for further replies.

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.
 
CosmoKramer;

Ya know, sometimes the answer is so obvious that no matter how hard you search for it you can't see it.

Thank you for your time and simple solution to this x-problem :)

Trying to keep this simple...

MrMajik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top