ACC: How to Remove Linked ( Attached) Tables with a Macro

Last reviewed: June 6, 1997
Article ID: Q93297
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

The TransferDatabase action is the macro equivalent of the Link Tables command (or Attach Table command in versions 1.x and 2.0). However, Microsoft Access does not have an action to delete a link to a linked (attached) table. To remove a linked table from the Database window, select the table in the Database window and press the DELETE key. You can also create a macro to delete a link to a linked table or you can call the action from code by using the DoCmd statement and the RunMacro method.

MORE INFORMATION

To delete a link to a linked table in Microsoft Access version 2.0, 7.0, or 97, create the following macro and save it as RemoveTable:

   Macro Name    Action
   --------------------------
   RemoveTable   DeleteObject

   RemoveTable Actions
   ---------------------------
   DeleteObject
      Object Type: Table
      Object Name: <tablename>

In code, use a DoCmd statement and the RunMacro Method to run the RemoveTable macro as follows:

   DoCmd.RunMacro "RemoveTable" ' In Microsoft Access 7.0 and 97

   DoCmd RunMacro "RemoveTable" ' In Microsoft Access version 2.0

To delete a link to a linked table in Microsoft Access version 1.x, create the following macro and save it as RemoveTable:

   Macro Name   Action
   -------------------------
   RemoveTable  SelectObject
                DoMenuItem

   RemoveTable Actions
   ---------------------------
   SelectObject
      Object Type: Table
      Object Name: <tablename>
      In Database Window: Yes
   DoMenuItem
      Menu Bar: Database
      Menu Name: Edit
      Command: Delete


Additional query words: unattach
Keywords : IntpOthr kbinterop kbusage McrHowto
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 6, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.