Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buffalo snowstorm error

Status
Not open for further replies.

mondo3a

Programmer
Oct 22, 2004
19
CA
When trying to use a table which is linked to our Buffalo location's (their internet is down today) access db, I get an error on the rst.open sql statement. The on error is not trapping this...what code can be written to catch this?

Private Function RetrieveLinkedCCCRST(ByVal strSQLString As String) As ADODB.Recordset
Dim rst As ADODB.Recordset
Dim strSQL As String

On Error GoTo Err_RetrieveLinkedCCCTableInventoryQuantity
strSQL = strSQLString

Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorLocation = adUseClient
rst.Open strSQL
Set RetrieveLinkedCCCRST = rst

Exit_RetrieveLinkedCCCTableInventoryQuantity:
Exit Function

Err_RetrieveLinkedCCCTableInventoryQuantity:
MsgBox "Unable to link to the table!"
Resume Exit_RetrieveLinkedCCCTableInventoryQuantity
End Function
 
Perhaps a check for the file would suit:
Code:
Dim tdf As DAO.TableDef
Dim db As DAO.Database
    
Set db = CurrentDb
Set tdf = db.TableDefs("ALinkedTable")

If Dir(Mid(tdf.Connect, 11)) = "" Then
    MsgBox "No file."
    Exit Sub
End If
 
That didnt work - I get the message "bad file name or number" when it hits your if statement.
 
tdf.connect = ";Database = \\cvault\access\acedata.mdb"

that's the path to the linked database.
 
How about:

Set fs = CreateObject("Scripting.FileSystemObject")
Debug.Print fs.FolderExists("\\cvault\access\")

You should get False if the folder does not exist.
 
That seems to work...thanks for all of your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top