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
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