My Assistant
![]() ![]() |
|
|
Mar 12 2005, 06:28 PM
Post
#1
|
|
|
UtterAccess Guru Posts: 976 |
I'm looking for VBA code to check if a report is already open prior to trying to open it. I've noticed that if a report is already open and the code tries to open it again, that the already open report gets the focus and appears on top of the windows. However, a user may have changed criteria and not realize that a report needs to apparantly be closed before it is opened. Hence, they may not realize that the report they see if for a different set of conditions. So, I guess I need code to check if the report is open and then close it, prior to reopening.
Can the report be refreshed instead of closing and then reopening? Thanks. |
|
|
|
Mar 12 2005, 07:06 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 3,752 From: Australia (NSW) |
Code to check if ANY (type of) object is open.
CODE Function IsObjectOpen(strName As String, _ Optional intObjectType As Integer = acForm) _ As Boolean ' intObjectType can be: ' acTable (value 0) ' acQuery (value 1) ' acForm (value 2) Default ' acReport (value 3) ' acMacro (value 4) ' acModule (value 5) ' Returns True if strName is open, False otherwise. On Error Resume Next IsObjectOpen = (SysCmd(acSysCmdGetObjectState, intObjectType, strName) <> 0) If Err <> 0 Then IsObjectOpen = False End If End Function Just REQUERY the report, rather than close and reopen |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 24th May 2013 - 03:51 AM |