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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminating link to a server in Access 97

Status
Not open for further replies.

LSTAN

Technical User
Feb 2, 2002
190
SG
Hi

I created a Access 97 database which when opened automatically link to an external table in a file server. My problem is that I want the link to be terminated no matter where/how the user quit Access. Where should I place the code or how should I go about it? The link table code is as follows:

Function LinkTable()
Dim myDb As Database
Dim myTdf As TableDef
Set myDb = CurrentDb
'
On Error GoTo Err_Check1
Set myTdf = myDb.CreateTableDef("mainTable", 0, "mainTable" _
, ";database=\\Fs1001\vol1\data\data\mainDB.mdb")
myTdf.SourceTableName = "mainTable"
myDb.TableDefs.Append myTdf
'
Exit Function
Err_Check1:
If Err.Number = 3044 Then
MsgBox Err.Description & ". " & "Please made sure you are login to the server." _
, vbOKOnly, "Error Message"
Exit Function
Else
MsgBox "Error Nos: " & Err.Number & ". " & Err.Description & ". " _
& "Please contact your system administrator.", vbOKOnly, "Error Message"
Exit Function
End If
End Function

Thanks and regards
LSTAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top