Prevent opening second instance software

JohnPapa

Registered User.
Local time
Tomorrow, 01:49
Joined
Aug 15, 2010
Messages
1,117
I would like to prevent the user from opening more than one instances of a certain software that is written in Access and uses Jet as the db. Any ideas?
 
I just want to add that I am talking about a multi-user db that is accessed from other PCs. I just want one instance max per PC.
 
Try this Function:
Code:
Function IsRunning() As Integer
    DoCmd.Maximize
    Dim db As DAO.Database
    Set db = CurrentDb()
        If TestDDELink(db.Name) Then
           MsgBox "The database is already open"
           Application.Quit
           Set Application = Nothing
        End If
End Function

Simon
 
Try this Function:
Code:
        If TestDDELink(db.Name) Then

That LOC comes up with warning that TestDDELink() is an undefined function.

Intriguing suggestion, kindly supply that function please.
 
Since this suggestion has verified existence of the database application already running, could I easily add after displaying the warning message sending Restore or Maximize to the other instance before exiting?

It has been many MANY years since I coded DDE... ;)
 
Ddduuuaaa... Not possible to communicate with the other instance of Access / same database, the DDEInitiate had an error! :p

If it had not gotten the error, this looks to be the correct DDE method to Maximize the entire Access window:

Code:
DDEExecute varDDEChannel, "[DoCmd.RunCommand acCmdAppMaximize]"
 

Users who are viewing this thread

Back
Top Bottom