S
SHIPP
I am trying to use the following code to relink a database's front end to the
back end.
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim intLoop As Integer
Dim intToChange As Integer
Dim strConnectNew As String
Dim strConnectOld As String
Dim strCurrSourceTable As String
Dim strCurrTable As String
Dim typExistingData() As TableDetails
Set dbCurr = CurrentDb
strConnectNew = DLookup("BackEndPathFile", "tblmaster", "[MasterID]=" & 1)
For Each tdfCurr In dbCurr.TableDefs
If Not IsNull(tdfCurr.Connect) Then
ReDim Preserve typExistingData(0 To intToChange)
typExistingData(intToChange).TableName = tdfCurr.Name
typExistingData(intToChange).SourceTableName = tdfCurr.SourceTableName
intToChange = intToChange + 1
End If
Next tdfCurr
If intToChange > 0 Then
For intLoop = 0 To (intToChange - 1)
dbCurr.TableDefs.Delete typExistingData(intLoop).TableName
Set tdfCurr = dbCurr.CreateTableDef(typExistingData(intLoop).TableName)
tdfCurr.Connect = strConnectNew
tdfCurr.SourceTableName = typExistingData(intLoop).SourceTableName
dbCurr.TableDefs.Append tdfCurr
Next intLoop
End If
Whenever I run it i receive a 3011 error. "The database could not lock table
MySysAccessStorage because it is already in use by another person or process.
I have also reviewed the code at
http://www.mvps.org/access/tables/tbl0009.htm. Same error. Please advise.
Thank you.
back end.
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim intLoop As Integer
Dim intToChange As Integer
Dim strConnectNew As String
Dim strConnectOld As String
Dim strCurrSourceTable As String
Dim strCurrTable As String
Dim typExistingData() As TableDetails
Set dbCurr = CurrentDb
strConnectNew = DLookup("BackEndPathFile", "tblmaster", "[MasterID]=" & 1)
For Each tdfCurr In dbCurr.TableDefs
If Not IsNull(tdfCurr.Connect) Then
ReDim Preserve typExistingData(0 To intToChange)
typExistingData(intToChange).TableName = tdfCurr.Name
typExistingData(intToChange).SourceTableName = tdfCurr.SourceTableName
intToChange = intToChange + 1
End If
Next tdfCurr
If intToChange > 0 Then
For intLoop = 0 To (intToChange - 1)
dbCurr.TableDefs.Delete typExistingData(intLoop).TableName
Set tdfCurr = dbCurr.CreateTableDef(typExistingData(intLoop).TableName)
tdfCurr.Connect = strConnectNew
tdfCurr.SourceTableName = typExistingData(intLoop).SourceTableName
dbCurr.TableDefs.Append tdfCurr
Next intLoop
End If
Whenever I run it i receive a 3011 error. "The database could not lock table
MySysAccessStorage because it is already in use by another person or process.
I have also reviewed the code at
http://www.mvps.org/access/tables/tbl0009.htm. Same error. Please advise.
Thank you.