Results 1 to 2 of 2
  1. #1
    SunTop is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Aug 2016
    Posts
    93

    Message on back end disconnection


    Hello Everyone
    I have a database that is split into a front end and a back end. Sometimes the network connection between the front end and the back end is disconnected. What I want to do is, if the user starts the front end and the front end is unable to connect to the back end, a message pops up to the user and after the user clicks ok, the front end exits (the access application exits entirely not only the database file closes). The other thing I want to do is, if the connection between the front end and back end is established and the network gets disconnected, I want a message to pop up to the user and after the user clicks ok the front end exits (the access application exits entirely not only the database file closes). How to do this ?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,939
    if the user starts the front end and the front end is unable to connect to the back end
    this is fairly straightforward. Using an autoexec or an initial form that does not have a recordsource connecting to the back end, use the Dir command to see if the backend is there - something like


    if dir("path to backend")="" then
    msgbox "cannot connect to backend, exiting now", vbOK+vbCritical
    docmd.quit
    end if

    you may need some error checking, not sure what dir will return if the path itself can't be found

    if the connection between the front end and back end is established and the network gets disconnected
    not so easy - you would need to use a timer event on permanently open form (can be hidden) with similar code, or perhaps better some routine is called every time the user tries to do something (e.g. before update, before insert, before open, perhaps a 'before scroll') to check the existence and some error checking code after the event. However if this is a regular thing, you should consider using sql server since access is susceptible to corruption with unmanaged disconnections.

    Also look at beginTrans and commitTrans to wrap around backend events - which should provide some protection if connection is lost during an update/append/delete event

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

Similar Threads

  1. Replies: 8
    Last Post: 05-15-2015, 05:11 PM
  2. Replies: 2
    Last Post: 01-23-2014, 12:40 PM
  3. Replies: 5
    Last Post: 05-27-2013, 09:34 AM
  4. Replies: 4
    Last Post: 05-21-2012, 08:21 AM
  5. Replies: 12
    Last Post: 12-05-2010, 09:01 PM

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