If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Delete Table
Dear Group
I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#2
|
|||
|
|||
Delete Table
Why not just open the database in design mode, select the Tables tab, select
the table you want delete, and press the Delete key? The code you posted should work in the VBA immediate window. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Dear Group I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#3
|
|||
|
|||
Delete Table
Thanks for reply Dave
There is date and some other conditions that must be met first then the table will be usless and then should be deleted, I don't know when these conditions will be met that's why I don't want to open the databse window and do it manually. So if my code didn't work what is the command to be used in order to run a delete query for that "Customers" table lets say the the query name is "DelCustomersQry" DoCmd.Runquery....or DoCmd Requery,...........etc. Thanks again -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: Why not just open the database in design mode, select the Tables tab, select the table you want delete, and press the Delete key? The code you posted should work in the VBA immediate window. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Dear Group I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#4
|
|||
|
|||
Delete Table
I think you want
Docmd.DeleteObject acTable, "TableName" -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Thanks for reply Dave There is date and some other conditions that must be met first then the table will be usless and then should be deleted, I don't know when these conditions will be met that's why I don't want to open the databse window and do it manually. So if my code didn't work what is the command to be used in order to run a delete query for that "Customers" table lets say the the query name is "DelCustomersQry" DoCmd.Runquery....or DoCmd Requery,...........etc. Thanks again -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: Why not just open the database in design mode, select the Tables tab, select the table you want delete, and press the Delete key? The code you posted should work in the VBA immediate window. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Dear Group I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#5
|
|||
|
|||
Delete Table
I Discovered why that code didn't work... that's because the table has some
relationships with other tables. so most properly I need to use a delete query can you show me the command to use to run this delete query??? Thanks a lot -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: I think you want Docmd.DeleteObject acTable, "TableName" -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Thanks for reply Dave There is date and some other conditions that must be met first then the table will be usless and then should be deleted, I don't know when these conditions will be met that's why I don't want to open the databse window and do it manually. So if my code didn't work what is the command to be used in order to run a delete query for that "Customers" table lets say the the query name is "DelCustomersQry" DoCmd.Runquery....or DoCmd Requery,...........etc. Thanks again -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: Why not just open the database in design mode, select the Tables tab, select the table you want delete, and press the Delete key? The code you posted should work in the VBA immediate window. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Dear Group I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#6
|
|||
|
|||
Delete Table
Use a command button, but if there are relationships to the table, then you
may be leaving orphan records in the other tables. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: I Discovered why that code didn't work... that's because the table has some relationships with other tables. so most properly I need to use a delete query can you show me the command to use to run this delete query??? Thanks a lot -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: I think you want Docmd.DeleteObject acTable, "TableName" -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Thanks for reply Dave There is date and some other conditions that must be met first then the table will be usless and then should be deleted, I don't know when these conditions will be met that's why I don't want to open the databse window and do it manually. So if my code didn't work what is the command to be used in order to run a delete query for that "Customers" table lets say the the query name is "DelCustomersQry" DoCmd.Runquery....or DoCmd Requery,...........etc. Thanks again -- M.A.Halim mmhalim at hot mail dot com "Klatuu" wrote: Why not just open the database in design mode, select the Tables tab, select the table you want delete, and press the Delete key? The code you posted should work in the VBA immediate window. -- Dave Hargis, Microsoft Access MVP "M.A.Halim" wrote: Dear Group I have a data base with some tables that I don't need any more, no longer in use and these tables just increasing the size of my database at the same time i don't want to use a delete query to get rid of these tables I used the following command but didn't work, but it actaully worked perfect with queries and reports? any Idea how can I use the right command? DoCmd.DeleteObject acTable, "Customers Tbl" Thanks A lot -- M.A.Halim mmhalim at hot mail dot com |
#7
|
|||
|
|||
Delete Table
On Tue, 7 Jul 2009 10:26:05 -0700, M.A.Halim
wrote: I Discovered why that code didn't work... that's because the table has some relationships with other tables. so most properly I need to use a delete query can you show me the command to use to run this delete query??? Thanks a lot Deleting the records will not delete the relationship. Your best bet would be to open the Relationships window; view the relationships to this table; click the relationship line joining the two table icons and press the delete key to delete the relationship. Then select the table in the Tables window and delete it. It makes NO difference *how* you delete the table, in code, in the query grid, or whatever - if there are reasons the table cannot yet be deleted, *don't delete it until those conditions are met*. Compact and Repair the database after you succeed in deleteing it, to recover the space it occupied. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|