Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    Atlanta, GA
    Posts
    187

    Unanswered: ALT + TAB closes object. HELP PLEASE

    Hi guys,
    I am facing a very weird problem that I am seeing for the first time.
    I have changed my application to work on ADO instead of RDO and this weird problem started occurring.
    When a user presses a button to search for a record, my app calls the stored procedure in SQL Server and if the user presses ALT + TAB to go into another application while they wait, the ADO object closes and an error occurs:
    Run Time error '3704'
    Operation is not allowed when the object is closed.

    And this does not happened every time. Only once in a while. Like if I would do it 10 times, it would happened only once.

    Any ideas as to what this could be? I am very puzzled right now.
    Please help.

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Not sure of the cause, but I've encountered this before.

    My work around is to trap the error.

    I create a global variable (DBCNXN) in a class module:

    Public DBCNXN As New ADODB.Connection

    I call this function when my app starts:

    Function SetDBCNXN()
    If DBCNXN.State = adStateClosed Then
    DBCNXN.Provider = "sqloledb.1"
    DBCNXN.Properties("Data Source").Value = "MYSERVER"
    DBCNXN.Properties("Initial Catalog").Value = "MYDATABASE"
    DBCNXN.Properties("Integrated Security").Value = "SSPI"
    DBCNXN.Open
    DBCNXN.CommandTimeout = 0
    End If
    End Function

    In my error traps in my code:

    If Err=3704 Then
    SetDBCNXN 'reestablish the connection that broke
    Resume 'go back to the offending lline
    Else
    ...
    End If
    Inspiration Through Fermentation

  3. #3
    Join Date
    May 2003
    Location
    Atlanta, GA
    Posts
    187
    Thanks, will the Resumego back to executing the stored procedure?

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    It will go back to the line that tried executing the stored procedure when it quit.
    Inspiration Through Fermentation

Posting Permissions

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