At first I thought I could just delete the tables and import the
tables. BUT my tables have relationships and I can not delete
a table with relations. So that only deleted the non relational tables
and imported them.
Now I am trying to relink the exported tables.
this is the code I am using
Public Function ReLink() As Boolean
On Error Resume Next
Dim astrTableNames(1000) As String
Dim iintTableNames As Integer
Dim intI As Integer, strTableName As String, strServer As String
Dim rst0 As Recordset
Dim dbs As Database
Set rst0 = CurrentDb.OpenRecordset("tlkpSysInfo")
strServer = Nz(rst0!extLocation)
rst0.Close
Set dbs = DBEngine.Workspaces(0).OpenDatabase(strServer, ,
dbReadOnly)
dbs.TableDefs.Refresh
For intI = 0 To dbs.TableDefs.Count - 1
strTableName = dbs.TableDefs(intI).Name
If Left$(strTableName, 3) = "tbl" Then
iintTableNames = iintTableNames + 1
astrTableNames(iintTableNames) = strTableName
End If
Next intI
Set dbs = Nothing
For intI = 1 To iintTableNames
Call TableDelete(astrTableNames(intI))
Next intI
CurrentDb.TableDefs.Refresh
For intI = 1 To iintTableNames
Call TableLink(strServer, astrTableNames(intI),
astrTableNames(intI))
Next intI
On Error GoTo 0
ReLink = True
End Function
================
Public Function TableLink(strLocation As String, strOldName As String,
strNewName As String) As Boolean
On Error Resume Next
DoCmd.TransferDatabase acLink, "Microsoft Access", strLocation,
acTable, strOldName, strNewName
If Err Then
TableLink = False
Else
TableLink = True
End If
On Error GoTo 0
End Function
===================
Public Function TableDelete(strTableName As String) As Integer
On Error Resume Next
DoCmd.DeleteObject A_TABLE, strTableName
MsgBox "deleting " & strTableName
If Err Then
TableDelete = False
Else
TableDelete = True
End If
On Error GoTo 0
End Function
I thought this would work but at best it will do
is for any existing table
tbltest
tblwork
tbldata
tbltest
tbltest1
tblwork
tblwork1
tbldata
tbldata1
the same as when I tried to delete and import.
can someone tell me how to delete or relink these tables with
relationships without getting incrememtal files?
thank you for any and all help
jerry