Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check if table available (2000)

    I have a linked table in my database, pointing to a table in a database on another machine.
    Is there a method of checking if the table is available (i.e. that the other machine is switched on) so that I can display a warning message if it can't be contacted.
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Check if table available (2000)

    You can do something like this:

    Function IsTableAvailable(TableName As String) As Boolean
    Dim cnn As ADODB.Connection
    Dim rst As New ADODB.Recordset

    On Error Resume Next

    Set cnn = CurrentProject.Connection
    rst.Open TableName, cnn
    IsTableAvailable = (Err = 0)

    rst.Close
    Set rst = Nothing
    Set cnn = Nothing
    End Function

    This function tries to open a recordset on the table and returns True if it succeeds, False if it fails.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check if table available (2000)

    Many thanks - works excellently (as usual)
    John

Posting Permissions

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