Prevent Multiple instance of Access 2010 Runtime (1 Viewer)

sigma788

Registered User.
Local time
Today, 09:55
Joined
Dec 1, 2009
Messages
40
hi all, is it possible to prevent
1- running multiple instance of MSACCESS.exe in runtime
2- running multiple instance of same database in runtime.

After searching,the posts i have found seems not to work on access 2010 runtime.
 

GinaWhipp

AWF VIP
Local time
Today, 12:55
Joined
Jun 21, 2011
Messages
5,899
Hmm, if the database is split, as it should be, run the Frontends in Exclusive Mode. Doing that should prevent the Users from opening multiple Frontends on their machines.
 

sigma788

Registered User.
Local time
Today, 09:55
Joined
Dec 1, 2009
Messages
40
In my case database is not splitted. so is it possible without splitting.
 

GinaWhipp

AWF VIP
Local time
Today, 12:55
Joined
Jun 21, 2011
Messages
5,899

sigma788

Registered User.
Local time
Today, 09:55
Joined
Dec 1, 2009
Messages
40
Thanks GinaWhipp for detailed reply.

My runtime database will be used by a single user only.
is it possible in that case to limit running multiple instance of ms access by single user

Regards.
 

GinaWhipp

AWF VIP
Local time
Today, 12:55
Joined
Jun 21, 2011
Messages
5,899
Then just set to open in Open in Exclusive Mode.
 

Simon_MT

Registered User.
Local time
Today, 17:55
Joined
Feb 26, 2007
Messages
2,177
Try:

Code:
Function IsRunning() As Integer

'    DoCmd.Maximize
    
 Dim db As DAO.Database
    Set db = CurrentDb()
    
    If IsRunningDDELink(db.Name) Then
        MsgBox "The database is already open"
        Application.Quit
        Set Application = Nothing
    End If

End Function
Code:
Private Function IsRunningDDELink(ByVal strAppName$) As Integer
    
Dim varDDEChannel
    
    On Error Resume Next
    Application.SetOption ("Ignore DDE Requests"), True
    varDDEChannel = DDEInitiate("MSAccess", strAppName)
    
   ' When the app isn't already running this will error
    If Err Then
       IsRunningDDELink = False
    Else
        IsRunningDDELink = True
        DDETerminate varDDEChannel
        DDETerminateAll
    End If
    Application.SetOption ("Ignore DDE Requests"), False
End Function

I have a Form on Startup and put IsRunning in the On Open Event

Simon
 

sigma788

Registered User.
Local time
Today, 09:55
Joined
Dec 1, 2009
Messages
40
thanks Simon.
is the code compatible with 2010 or am i doing something wrong.
i am not able to make the code work.

Regards.
 

Users who are viewing this thread

Top Bottom