PC Review Forums Newsgroups Microsoft Access Microsoft Access VBA Modules delete mutiple objects at once

Reply

delete mutiple objects at once

 
Thread Tools Rate Thread
Old 24-05-2004, 07:02 AM   #1
Dave
Guest
 
Posts: n/a
Default delete mutiple objects at once


Hi all,
Our '97 back end db has temp tables created in it, all
prefixed with the letters AA. Is there a way to delete
them all in one hit instead of manually deleting each?
There is another sequence of tables prefixed with ZZ, so
this procedure will save me time each time it needs to be
repeated.
Thanks in advance,
Dave
  Reply With Quote
Old 24-05-2004, 09:25 AM   #2
Allen Browne
Guest
 
Posts: n/a
Default Re: delete mutiple objects at once

Quickest way will probably be to hold down the Shift key while deleting them
from the Database window. (This avoids the confirmation dialog.)

If you want to do it programmatically, you could loop backwards through the
TableDefs collection, deleting those with a matching Name.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dave" <anonymous@discussions.microsoft.com> wrote in message
news:1111001c4414c$5f40aad0$a601280a@phx.gbl...
>
> Our '97 back end db has temp tables created in it, all
> prefixed with the letters AA. Is there a way to delete
> them all in one hit instead of manually deleting each?
> There is another sequence of tables prefixed with ZZ, so
> this procedure will save me time each time it needs to be
> repeated.
> Thanks in advance,
> Dave



  Reply With Quote
Old 24-05-2004, 02:54 PM   #3
solex
Guest
 
Posts: n/a
Default Re: delete mutiple objects at once

Unfortunately, you will need to delete and confirm each and every deletion
access does not allow you to make multiple selections in the database
window. Otherwise you can do as Allen suggested and write some code to
delete the tables.

Regards,
Dan

"Dave" <anonymous@discussions.microsoft.com> wrote in message
news:1111001c4414c$5f40aad0$a601280a@phx.gbl...
> Hi all,
> Our '97 back end db has temp tables created in it, all
> prefixed with the letters AA. Is there a way to delete
> them all in one hit instead of manually deleting each?
> There is another sequence of tables prefixed with ZZ, so
> this procedure will save me time each time it needs to be
> repeated.
> Thanks in advance,
> Dave



  Reply With Quote
Old 24-05-2004, 07:08 PM   #4
Chris Nebinger
Guest
 
Posts: n/a
Default delete mutiple objects at once

Using DAO:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select Name from
msysobjects where type = 1 and left(name,2)='aa'")
Dim rows() As String
Dim intCounter As Integer
ReDim rows(0)
Do Until rst.EOF
ReDim Preserve rows(UBound(rows) + 1)
rows(UBound(rows)) = rst("Name")
rst.MoveNext
Loop
For intCounter = 1 To UBound(rows)
DoCmd.DeleteObject acTable, rows(intCounter)
Next


There is no error handling, or object clean up in that
code, but it will work.


Chris Nebinger
>-----Original Message-----
>Hi all,
>Our '97 back end db has temp tables created in it, all
>prefixed with the letters AA. Is there a way to delete
>them all in one hit instead of manually deleting each?
>There is another sequence of tables prefixed with ZZ, so
>this procedure will save me time each time it needs to be
>repeated.
>Thanks in advance,
>Dave
>.
>

  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

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