I have this code that I have adapted from a post i found on here.
I want to close all open reports in the current database
The code is in the Timer event of a hidden form (frmRprtTimer) that opens when any report opens.
Option Compare Database
Private Sub Form_Timer()
On Error GoTo Err_Form_Timer
Dim rpt As Report
Dim db As Database
Dim cont As Container
Set db = CurrentDb()
Set cont = db.Containers("Reports")
For Each rpt In cont
DoCmd.Close acForm, "frmRprtTimer"
I keep getting an error.
Can anyone help?