PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
delete mutiple objects at once
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
delete mutiple objects at once
![]() |
delete mutiple objects at once |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 >. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

