Results 1 to 7 of 7
  1. #1
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150

    Exit nicely if can't access back end


    Hey all,I have a problem that I don't know how to solve. I have two projects using my database at work, each project has it's own backend that is stored on a shared drive that only users from that project can access. I have a single front end which opens with a "Please select your project" form that then sets up the links to the appropriate BE.The problem I have is that when the database initially opens, it tries to set up the links to the BE that the database was connected to at the time it compiled. If this is not the user's project the user get's an error message saying that the back end is locked and can't be accessed and the select project form doesn't load. I can create two versions of the front end, one compiled while attached to project A and one compiled while attached to project B but I don't like this solution. Is there a way to get the database to try and connect and if not, just to fail and allow the form to load?Something along the lines of en error resume next but for when the database initially opens? This is likely to become a bigger problem as more projects start to use the database.Hope that makes sense.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    It should work if you load an unbound form to pick the BE. As long as no code, nor form accesses the table, then there should not be an error.
    I had something similar, and it only failed if I accessed a table before I relinked.

  3. #3
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150
    Oh I think I know what it is, it is an unbound form but I have the following code in it's onload event that does try and find a table. DoCmd.SelectObject acTable, "TEMP", True DoCmd.RunCommand acCmdWindowHideSo it has to look for a table and then can't find it hence the error, does that sound plausible?Am I right in thinking it can be any item in the navigation window that can be selected for the above code to work? If so, I could just changed TEMP which is a table to something that is a form or query and the problem should go away. Do you think that would work?Thanks a lot

  4. #4
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150
    As an aside, carriage returns don't appear to work in these forum posts. Am I missing something about how this forum works?

  5. #5
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Why not have TEMP (or another table, like WhereAMI) in both backends. Then depending on what you find there, link into the proper BE. You wouldn't have to ask the user anything.

  6. #6
    Robyn_P's Avatar
    Robyn_P is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2017
    Posts
    150
    The table is in both backends. I think (and this is based on assumptions) that the problem is that the drive permissions mean that the BE can't be contacted if that database was compiles linked to project B and someone who is on project A tries to access it because they don't have access to the drive that project B is on and at startup it tries to link to the database it was most recently linked to.

  7. #7
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    http://www.jstreettech.com/downloads.aspx

    Check this out. I use this concept when I email customers a revised FE. The BE it wants to see when the customer opens it is mine, of course. This code checks for existence of tables and if missing can ask the customer for the location of his BE and link it.
    The code is executed via autoexec macro before any linked form is opened. If the tables are not found, the code opens an unbound form that shows a file dialog request for the location of the BE.
    Last edited by davegri; 11-17-2017 at 03:32 PM. Reason: clarif

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

Similar Threads

  1. Button to exit access completely
    By mcmcd99 in forum Access
    Replies: 3
    Last Post: 11-01-2017, 01:07 PM
  2. Replies: 1
    Last Post: 02-23-2015, 07:06 AM
  3. Replies: 2
    Last Post: 12-20-2012, 03:06 PM
  4. Replies: 4
    Last Post: 05-21-2012, 08:21 AM
  5. How do I capture Access DB exit event
    By jscriptor09 in forum Access
    Replies: 3
    Last Post: 09-21-2011, 09:45 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