A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Delete Table



 
 
Thread Tools Display Modes
  #1  
Old July 7th, 2009, 05:24 PM posted to microsoft.public.access
M.A.Halim[_2_]
external usenet poster
 
Posts: 45
Default 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  
Old July 7th, 2009, 05:51 PM posted to microsoft.public.access
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old July 7th, 2009, 06:09 PM posted to microsoft.public.access
M.A.Halim[_2_]
external usenet poster
 
Posts: 45
Default 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  
Old July 7th, 2009, 06:18 PM posted to microsoft.public.access
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old July 7th, 2009, 06:26 PM posted to microsoft.public.access
M.A.Halim[_2_]
external usenet poster
 
Posts: 45
Default 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  
Old July 7th, 2009, 06:47 PM posted to microsoft.public.access
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old July 7th, 2009, 07:58 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.