Check if form is open on another database (1 Viewer)

Bieke

Member
Local time
Today, 03:22
Joined
Nov 24, 2017
Messages
78
Hello,

I want to check if a form is open in another database. I've already now how to do this on the current database.

Thanks in advance.

Bieke
 
Refer to the other database as an object in your db?
 
Code:
Const dbPath As String = "C:\Program Files\PPI Caseflow\PPI Caseflow.mde"

On Error GoTo Err_Handler
    
    Dim appAccess As Access.Application
    
    Set appAccess = GetObject(dbPath)
    
    ' appAccess.Visible = True
    
    appAccess.DoCmd.OpenForm "frm_Caseflow"
 
Code:
Const dbPath As String = "C:\Program Files\PPI Caseflow\PPI Caseflow.mde"

On Error GoTo Err_Handler
   
    Dim appAccess As Access.Application
   
    Set appAccess = GetObject(dbPath)
   
    ' appAccess.Visible = True
   
    appAccess.DoCmd.OpenForm "frm_Caseflow"
I've tested it and it works, thanks for the reply Gasman.
 
Of course it works. :)
I used it on a DB I created for a UK bank, for a department I was working in.
The bank had a very basic Access DB to monitor our work.
That code connected to theirs to be able to post the account worked on manumatically.
 
I'll toss one caveat in the mix... depending on permissions on the two different databases, this might not be permitted. @Bieke - you say it works, so in your case permissions are favorable. However, be aware that in some situations this might not be possible. For instance, if this were done on a server and two different users had opened the two DBs, Windows process-privacy rules could intervene. If you tried this again and it failed, you might be unpleasantly surprised.
 
I'll toss one caveat in the mix... depending on permissions on the two different databases, this might not be permitted. @Bieke - you say it works, so in your case permissions are favorable. However, be aware that in some situations this might not be possible. For instance, if this were done on a server and two different users had opened the two DBs, Windows process-privacy rules could intervene. If you tried this again and it failed, you might be unpleasantly surprised.
In my case it works and the databases or both on server so i think i'm just lucky .... :)
 

Users who are viewing this thread

Back
Top Bottom