MrMajik
IS-IT--Management
- Apr 2, 2002
- 267
I have a report that is completely created by code for printing purposes. When the print job is done the report is deleted from memory; the report is never saved. I need the VB code to test to see if the report is open. I tried the Report collection but because it is not a saved report it doesn't show up.
By default Access names a code-generated report Report1, Report2, Report3, etc.
Here is the code that I tried but does not see the report:
Dim rptObj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
For Each rptObj In dbs.AllReports
If rptObj.Name = "Report1" Then
DoCmd.DeleteObject acReport, "Report1"
Exit For
End If
Next rptObj
Any ideas?
Thank you.
Everything should be made as simple as possible, but not simpler
--Albert Einstein
By default Access names a code-generated report Report1, Report2, Report3, etc.
Here is the code that I tried but does not see the report:
Dim rptObj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
For Each rptObj In dbs.AllReports
If rptObj.Name = "Report1" Then
DoCmd.DeleteObject acReport, "Report1"
Exit For
End If
Next rptObj
Any ideas?
Thank you.
Everything should be made as simple as possible, but not simpler
--Albert Einstein