vba to close report without name (1 Viewer)

John thomas

Registered User.
Local time
Yesterday, 18:15
Joined
Sep 4, 2012
Messages
206
Hi is there a way to use vba to close the currently open report on the screen without specifying its name
Thank you
 

vbaInet

AWF VIP
Local time
Today, 02:15
Joined
Jan 22, 2010
Messages
26,374
If it's the only report opened then:
Code:
    DoCmd.Close acReport, Reports(0).Name, acSaveNo

If there are several reports opened but you want to close the active one then:
Code:
    DoCmd.Close acReport, Screen.ActiveReport.Name, acSaveNo
 

John thomas

Registered User.
Local time
Yesterday, 18:15
Joined
Sep 4, 2012
Messages
206
Hi
Thats exactly what I need
Thanks for your help
John
 

Users who are viewing this thread

Top Bottom