Solved

Delete Table Module

Posted on 2006-07-20
4
384 Views
Last Modified: 2006-11-18
I'm running a module in access to delete a table each day but I have more than one table that needs to be deleted
the code is;

Public Function DeleteTable()
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
  If tdf.Name = "B0101" Then
    DoCmd.DeleteObject acTable, tdf.Name
    CurrentDb.TableDefs.Refresh
  End If
Next tdf
End Function

but I need to delete "B0101", "B0102", "B0103" etc....
can someone show me how to add the other tables into the code?
0
Comment
Question by:smidgen
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
Hi smidgen,

Depends what 'etc' means.

If you just want to delete all tables beginning with B then :

if left(tdf.name,1) = "B" then


Pete
0
 
LVL 3

Expert Comment

by:JefKve
Comment Utility
Public Function DeleteTable()
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
  If (tdf.Name = "B0101" or tdf.Name = "B0102" or tdf.Name = "B0103")  Then
    DoCmd.DeleteObject acTable, tdf.Name
    CurrentDb.TableDefs.Refresh
  End If
Next tdf
End Function

but I need to delete "B0101", "B0102", "B0103" etc....
can someone show me how to add the other tables into the code?
0
 

Author Comment

by:smidgen
Comment Utility
thanks peter57r
worked perfectly
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Thanks

Pete
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now