Access 2007 Split DB Un-Link Tables

Posted on 2014-10-22
Last Modified: 2014-10-23
I am looking for code to un-link all tables that are connected to the split backend DB
Question by:CMILLER
  • 5
  • 5
  • 2
LVL 75
ID: 40398251
Are you aware that you can just manually Delete the links via the Navigation Pane ?

LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 100 total points
ID: 40398260
Because any VBA Code solution would simply Delete those table names.

LVL 84

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 400 total points
ID: 40398264
You can do it with code like this:

Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDB
For Each tdf in dbs.TableDefs
  If Len(tdf.Connect) > 0 Then
    DoCmd.DeleteObject acTable, tdf.Name
  End If
Next tdf

Open in new window


Author Comment

ID: 40398442

Yes and I tried that but when I ran the code that I have to re-link the backend tables it didnt add the one table back that I deleted.

Author Comment

ID: 40398443
Here is what I am using to link the tables.

Function HQlinkTable()
On Error GoTo Relink_Error
Dim dbs As DAO.Database, strBEPath As String
Dim tdf As DAO.TableDef
Set dbs = CurrentDb()
strBEPath = "\\server-name\folder1\folder2\db_be.accdb"
Dim dbData  As DAO.Database
Set dbData = DBEngine.OpenDatabase(strBEPath)
     For Each tdf In dbs.TableDefs
          If tdf.Connect <> "" Then
               tdf.Connect = ";DATABASE=" & strBEPath
          End If
Set dbData = Nothing

'add this line
If Err = 0 Then
MsgBox "DB Table Linking Process Successful"
End If

     If Err.Number = 3024 Then
          MsgBox "Unable to connect to data tables!" & vbCrLf & "Closing Application", vbQuestion, "DATA TABLES MISSING!"
     End If
End Function

Author Comment

ID: 40398446
Scott McDaniel,

When I run that code it removes all the tables but the only way to relink them is to manually import them back in.
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

LVL 75
ID: 40398498
You didn't say anything about relinking ...

And ... if you delete the links, then you have to manually link them using the Access UI before you can 'relink' them ...for example if the BE is moved ... and you need to Relink.   Relinking is generally done when a BE is moved.  If there are no tables currently linked (to relink), then you need to manually Link to get started.


LVL 75
ID: 40398501
This image should  have been above the first image above

LVL 84
ID: 40399071
When I run that code it removes all the tables but the only way to relink them is to manually import them back in.
As Joe mentioned, you didn't say you wanted to relink, only "un-link" them.

You can relink in several ways. Joe has shown you the manual method. If you'd like a way to RE-link that tables - that is to "refresh" the links - then you can either write your own method, or use one of the many free processes out there. Armen Stein's J Street Access Relinker ( is a nice one, and should do everything you need.

Author Comment

ID: 40399567
Sorry, for not asking the question correctly.

Yes, I know how to re-link them manually.

I will ask a new question.
LVL 75
ID: 40399982
"You can relink in several ways. Joe has shown you the manual method. "
Actually ... I showed how to Link, not relink ... since relinking technically ... only applies to tables already Linked to a BE. And Armen's tool does Relinking ... not initial Linking - of previously unlinked tables.

Further, I actually explained why the code we supplied was not doing what you asked - and how to correct that issue.

Just sayin' ...


Author Comment

ID: 40400235
The code that I posted for this question is how I relink the tables.

I use this split DB for three diff dept's on three diff networks. The code that I have fine.

I have another use for the split DB and need a quick way to unlink....delete....etc.

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
*Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now