Relink issue

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

Chris O'C via AccessMonster.com

MSysAccessStorage is a system table in replicated databases in the Access
2002-2003 database format. Unless your front end application needs to query
this system table (such as for a utility), your front end shouldn't be linked
to it -- or any other system tables in the back end for that matter.

Linking/querying system tables isn't normal database application behavior.
Was the original linking to this system table an accident?

Chris
Microsoft MVP

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top