Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097

    How to avoid another instance of an app

    I've run into a problem with a user that opens an Access app, performs several actions, that might or might not involve a data update, suspends actions and moves off to several other Windows based apps, browser, mail etc.. Then when wanting to return to the Access app launches a 2nd instance of the same Access app. While the app error handlers deal with DB conflicts appropriately, the user is unsophisticated to an extent that problems encountered persist. So, I need an approach the includes detection of the already running app and the VBA to re-activate the initial instance.



    I can look to see if the app has an "ldb" file of itself, but if so how does one reactivate the app associated with the "ldb"? NOTE: there could be other Access Applications running, so it does not suffice to simply look for the Access Application. That is, code like inserted here wouldn't work:
    Code:
    Dim objX As Access.Application
    
    Set objX = GetObject(, "Access.Application")
    
    If Not objX Is Nothing Then
    MsgBox "MS Access is already open!"
    End If
    Thanks,
    Bill

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Not foolproof but why not just log them in in the user table. Surely you have one by now?
    There should be nothing wrong with opening multiple instances of Access (assuming they actually have the full program), just not multiple sessions by the same user in the same db?
    One issue with logging in is that some people will go to any length to exit abnormally, even to the point of pulling the plug (literally). Those (ahem) miscreants will have to either
    a) get a message that they're already logged in and thus resume the existing app
    b) be caught doing an abnormal shutdown and requiring an admin to remove their login flag (whatever that may be), upon which after the 2nd time they are summarily hung by their eyelids and beaten until they blink.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    I've only had to do this for one client.

    I have the app check if user is already logged in (a login table) and if so exits with a message, 'app already open'

    If the user has exited illegally (i.e. without closing the app properly and logging out) then they run another app which takes them through the hoops to logout. My client insisted this process should take a few minutes and asks for all sorts of irrelevant information (security questions if you like) to emphasise to the user the error of their ways. Just unfortunate if the close was by accident (powercut whatever)

  4. #4
    wvmitchell is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2020
    Posts
    24
    You could change Access to open Exclusive, instead of Shared which is the default. In that way, if they try to open another instance it will stop them.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Selecting hihest instance in a tbl
    By Ciaran in forum Queries
    Replies: 2
    Last Post: 08-01-2015, 10:59 PM
  2. Replies: 2
    Last Post: 07-14-2015, 11:39 AM
  3. Replies: 5
    Last Post: 10-11-2013, 07:29 AM
  4. Replies: 5
    Last Post: 09-14-2012, 04:56 PM
  5. Multiple Instance Form
    By steve.roic@bellsouth.net in forum Forms
    Replies: 0
    Last Post: 05-19-2010, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums