PC Review


Reply
Thread Tools Rate Thread

Delete Objects Errors

 
 
Ripper
Guest
Posts: n/a
 
      29th Apr 2010
I have a database that I clear out between uses. No need to store
information from use to use. I use a macro to delete the temorary tables
that I create from various queries etc. However, I don't always need to
create all the temp tables, so when I use the macro with the Delete Object
function I get an Action Failed Error even though I set Warning to false.

How can I set a macro or some process to delete tables that are there and
skip over the tables that were not created?
--
Thanks As Always
Rip
 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      30th Apr 2010
Rip,

One workaround here would be to put in an OpenQuery action to run a
Make-Table query for each of the tables you want to delete. If the table
already exists, that will be fine. If it doesn't already exist, then it
will now, and thus the DeleteObject will not fail.

Other than that, you can write a VBA procedure/function to test for the
existence of the table. This would work by looping throught the database's
TableDef objects.

--
Steve Schapel, Microsoft Access MVP


"Ripper" <(E-Mail Removed)> wrote in message
news:AD3E06DD-0A24-40E0-8126-(E-Mail Removed)...
> I have a database that I clear out between uses. No need to store
> information from use to use. I use a macro to delete the temorary tables
> that I create from various queries etc. However, I don't always need to
> create all the temp tables, so when I use the macro with the Delete Object
> function I get an Action Failed Error even though I set Warning to false.
>
> How can I set a macro or some process to delete tables that are there and
> skip over the tables that were not created?
> --
> Thanks As Always
> Rip


 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      2nd May 2010
I agree, Peter, that's a good approach.

--
Steve Schapel, Microsoft Access MVP


PieterLinden wrote ...
>
> Seems like the easiest thing to do would be to use a sub and do something
> like
> Public Sub DeleteTables
> On Error Resume Next
> DBEngine(0)(0).Execute "DROP TABLE [tablename1]"
> DBEngine(0)(0).Execute "DROP TABLE [tablename2]"
> End Sub


 
Reply With Quote
 
ricardo suárez. publicista
Guest
Posts: n/a
 
      3rd May 2010
cdscs


En e#(E-Mail Removed) del 1/05/10 22:59, "Steve Schapel"
<(E-Mail Removed)> escribió:

> I agree, Peter, that's a good approach.


 
Reply With Quote
 
Ripper
Guest
Posts: n/a
 
      5th May 2010
Thanks Steve. That worked perfectly! Since I am already deleting the table
it doesn't matter if I make one over existing ones.
--
Thanks As Always
Rip


"Steve Schapel" wrote:

> Rip,
>
> One workaround here would be to put in an OpenQuery action to run a
> Make-Table query for each of the tables you want to delete. If the table
> already exists, that will be fine. If it doesn't already exist, then it
> will now, and thus the DeleteObject will not fail.
>
> Other than that, you can write a VBA procedure/function to test for the
> existence of the table. This would work by looping throught the database's
> TableDef objects.
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "Ripper" <(E-Mail Removed)> wrote in message
> news:AD3E06DD-0A24-40E0-8126-(E-Mail Removed)...
> > I have a database that I clear out between uses. No need to store
> > information from use to use. I use a macro to delete the temorary tables
> > that I create from various queries etc. However, I don't always need to
> > create all the temp tables, so when I use the macro with the Delete Object
> > function I get an Action Failed Error even though I set Warning to false.
> >
> > How can I set a macro or some process to delete tables that are there and
> > skip over the tables that were not created?
> > --
> > Thanks As Always
> > Rip

>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete current row AND delete objects also located in thatrow. Tonso Microsoft Excel Discussion 3 27th Jan 2009 02:43 PM
Errors on linked excel objects Peter Bebbington Microsoft Powerpoint 1 4th Oct 2008 06:12 AM
How do you edit or delete objects in Insert Objects box in Word? =?Utf-8?B?Qm9iIFQ=?= Microsoft Word Document Management 1 6th Nov 2007 01:46 PM
strange errors when using Access objects =?Utf-8?B?QWxsZW5fTg==?= Microsoft Access VBA Modules 7 29th Jul 2006 01:56 PM
various errors importing objects MarkD Microsoft Access 3 12th Sep 2004 10:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:09 AM.