Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Evansville, Indiana
    Posts
    76

    Question Unanswered: Trapping ADP Connection error *on startup*

    Hi all!

    This is driving me bonkers! I have an Access Data Project, which on start-up opens a form. What happens is if the SQL Server/database is offline, doesn't exist, whatever, I get the following dialog:

    "Access is unable to connect to [db name] database on the [SQL server name] server. Make sure that the database still exists and that the server is running."

    This error occurrs before my start-up form fires (and it actually still opens after hitting OK on the error dialog.)

    There doesn't seem to be an event, property, etc., at the ADP level where you can have code run to check if the ADP is actually connected to SQL Server successfully.

    I thought about adding the following code somewhere:
    Code:
    Public Function IsADPConnected() As Boolean
        If CurrentProject.IsConnected Then
            DoCmd.OpenForm "frmSplash"
            IsADPConnected = True
        Else
            MsgBox "The system is unavailable at this time." & vbCrLf _
               & "Please contact the help desk for further assistance.", vbCritical
            IsADPConnected = False
        End If
    End Function
    ...however, I can't find a place anywhere to make a call to my IsADPConnected function. I was going to do something like:
    Code:
    If Not IsADPConnected Then
       DoCmd.Quit
    End If
    Does anyone have any ideas on how to trap for this error or maybe use some creative way to accomplish the same thing?

    Thanks!
    Last edited by kaeldowdy; 08-24-06 at 18:06.
    Kael Dowdy, MCSD, MCDBA

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I have just started converting my MDBs to ADPs with a SQL Server backend. Right now I only have two test environments (Laptop and Server) but I am very interested in a solution.

    I have only done a cursory search for details, but I found OpenConnection and the BaseConnectionString property. This looks like the way to change the connection for the ADP, but as far as trapping the error I am still looking. I just wanted to respond to your post to let you know I am interested and will continue to look for a solution. So if you don't mind sharing anything you find, I will do the same.

    I plan to do some more looking tomorrow and will update you with anything I find.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •