Ms Access Error 2387
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 05-02-2007, 05:30 PM #1 Libre been around a little Join Date: May 2007 Location: NYC Posts: 654 Thanks: 23 Thanked 29 Times in 26 Posts Deleting Relationships Programatically Hi - I'm new here, and I hope you don't mind if I jump right in with a question. Suppose I want to delete a table, programatically. I could write: DoCmd.DeleteObject acTable, "myTable" Now, that would work, unless the table was related to another table, and then I would get this error- Run Time Error '2387': You can't delete the table 'myTable'; it is participating in one or more relationships. Can anyone tell me how to delete the relationship, programatically, before executing the delete table command? In fact, what I REALLY want to do is to delete ALL the relationships, and then ALL the tables in the entire db. And of course, I want to do it all programatically, not by selecting the objects and hitting the delete key. Any help would be greatly apprecitated. Thanks in advance. Libre View Public Profile Visit Libre's homepage! Find More Posts by Libre 05-02-2007, 11:48 PM #2 dsigner Registered User Join Date: Jun 2006 Posts: 68 Thanks: 0 Thanked 0 Times in 0 Posts If you delete all tables and all relationships then anything else like a query or form will fail so you would be just as well opening a new clean database. If there is something in the old one which you want just copy it across. dsigner View Public Profile Visit dsigner's homepage! Find More Posts by dsigner 05-03-2007, 01:26 AM #3 Dennisk AWF VIP Join Date: Jul 2004 Posts: 1,649 Thanks: 0 Thanked 9 Times in 5 Posts I think you need to open the schema to add or remove relationships. Dennisk View Public Profile Find More Posts by Dennisk 05-03-2007, 04:36 AM #4 Libre been around a little Join Date: May 2007 Location: NYC Posts: 654 Thanks: 23 Thanked 29 Times in 26 Posts dsigner- I guess I should explain why I would want to delete all the tables. You see, I have an installation of my db here at work, that is under development. But we still use i
Custom Search UtterAccess Forums>Microsoft® Access>Access Tables + Relationships Error 2387 Can't delete the table.... Forum HomeSearchHelpUA Messages|-- UtterAccess.com NewsAccess Knowledge Center|-- Access Code Archive|-- Access Knowledgebase / FAQ|-- Access TutorialsMicrosoft® Access|-- Local Access User Groups (AUGs)|-- Interface Design|-- Access Q and A|-- Access Tables + Relationships|-- Access Queries|-- Access Forms|-- Access Reports|-- Access Macros|-- Access Modules|-- Access Date + Time|-- Access Errors http://www.access-programmers.co.uk/forums/showthread.php?t=127811 + Error Handling|-- Access Built-in Functions|-- Access Searching + Data Mining|-- Access Records|-- Access Security|-- Access Automation|-- Access Database Container|-- Tool bars, Menu bars + Ribbon|-- Access Services (Web Databases)|-- Access Data Access Pages (Deprecated)|-- Access Data Projects - ADP|-- Access Runtime, Packaging & DeploymentAnd More...|-- Microsoft SQL http://www.utteraccess.com/forum/Error-2387-delete-table-t1597118.html&mode=threaded Server|-- SQL Server Reporting Services|-- Microsoft SharePoint|-- Microsoft Internet Explorer|-- Visual Basic 6 and Earlier|-- Visual Basic 2003 and Later|-- ASP and VBScript|-- Web Development|-- PHP, Perl, MySQL and Postgres|-- Other Database Engines|-- BI Tools and Applications|-- JAVA and C#|-- GraphicsMicrosoft® Office|-- Microsoft Excel|-- Microsoft Excel FAQs|-- Microsoft Word|-- Microsoft Outlook|-- Microsoft PowerPoint|-- Microsoft FrontPage/Exp. Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Q & A - UtterAccess.com Forums|-- Q & A - Access Wiki Options VPlantView Member Profile Feb 22 2008, 10:54 PM Post#1Posts: 3Joined: 22-February 08The detailed error is "You can't delete the table '|'; it is participating in one or more [email=relationships.@If]relationships.@If[/email] you want to delete this table, first delete its relationships in t
trying to programmatically deletetables, but keep encountering http://microsoft.public.access.modulescoding.narkive.com/rplaY4xx/error-2387-deleting-tables-involved-in-relationships-w-vba-code the following error message:"Run-time error 2387: You https://support.office.com/en-us/article/I-get-the-error-message-Could-not-delete-from-the-specified-tables-20dec5e8-5402-4667-802d-523cf4923a46 can't delete the table 'Acknowledged';it is participating in one or more relationships."Is there a way to delete these relationships first using vba code and thendelete the tables? ms access This is a sample of the code of using:For Each tdf In .TableDefsIf Left(tdf.Name, 1) <> "~" ThenIf Left(tdf.Name, 4) <> "MSys" ThenIf Left(tdf.Name, 4) <> "ztbl" ThenstrTableName = tdf.NameDoCmd.DeleteObject acTable, strTableNameor.TableDefs.Delete tdf.NameApplication.RefreshDatabaseWindowEnd IfEnd IfEnd ms access error IfNext tdfThanks for your help.Kevin Tim Ferguson 2006-03-20 18:17:34 UTC PermalinkRaw Message Post by Microsoft News GroupsIs there a way to delete these relationships first using vba code andYou can either interate the Relationships collection, or you can simply usea DDL command likedb.Execute "ALTER TABLE MyTable DROP CONSTRAINT MyFKConstraint", _dbFailOnErrorThat said, it's usually easier, faster, and much safer to empty the tablerather than to drop it.Hope that helpsTim F 1 Reply 211 Views Switch to linear view Disable enhanced parsing Permalink to this page Thread Navigation Microsoft News Groups 2006-03-20 17:22:40 UTC Tim Ferguson 2006-03-20 18:17:34 UTC about - legalese Loading...
"Could not delete from the specified tables" Applies To: Access 2016, Access 2013, Access 2010, Access 2007, Less Applies To: Access 2016 , Access 2013 , Access 2010 , Access 2007 , More... Which version do I have? More... When you run a delete query, Access may display the error message Could not delete from the specified tables. This article lists cases in which you can use a delete query, explains why the error message appears, and provides steps for correcting the error. There are a number of ways to delete records in Access. For a more thorough explanation of deleting records, see the article Delete one or more records from a database. In this article Introduction Why am I seeing this error message, and how do I fix it? Introduction When you want to delete multiple records from a table in one operation, you can use a delete query. A delete query is successful when it: Uses a single table that does not have a relationship to any other table. Combines two tables that have a one-to-one relationship. Uses a single table that is one the "one" side of a one-to-many relationship, and cascading delete is enabled for that relationship. Includes both the table on the "one" side of a one-to-many relationship and the table on the "many" side of that relationship (for example, to use criteria on a field from the "many" table). Important    You must run the query twice to delete records from both tables. Top of Page Why am I seeing this error message, and how do I fix it? If you build a delete query by using multiple tables and the query's Unique Records property is set to No, Access displays the error message Could not delete from the specified tables when you run the query. To fix this problem, set the query's Unique Records property to Yes. Open the delete query in Design view. If the query property sheet is not open, press F4 to open it. Click the query designer to show the query properties (rather than the field properties). In the query property sheet, locate the Unique Records property, and set it to Yes. Top of Page Share Was this information helpful? Yes No Great! Any other feedback? How can we improve it? Send No thanks Thank you for your feedback! × English (United States) Contact Us Privacy & Cookies Terms of use & sale Trademarks