Solved

delete all access tables with a prefix

Posted on 2015-01-26
2
126 Views
Last Modified: 2015-08-03
I have a list of tables in an access mdb ... i want to delete all tables with a particular prefix within the mdb and delete the tables in a directory with the same table names.  For example:  tables -- sample_1, sample_2 ... (all tables beginning with "sample" would be deleted) and a directory "C:/" ... there are tables sample_1.xls, sample_2.xls, ... these table would also be deleted.
0
Comment
Question by:SFWolverine
  • 2
2 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
this codes will delecte all tables with prefix mentioned above in the db

dim db as dao.database, td as dao.tabledef

for each td in db.tabledefs
if td.name like "sample_*" then
   db.execute "drop table " & "[" & td.name & "]"
next
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
to delete the excel files

dim strPath as string, xlFile as string
strPath="C:\"
xlFile=dir(strPath & "*.xls")
while xlFile <>""
    if xlfile like "sample_*" then
       kill strPath & xlFile
    end if
    xlFile=dir
wend
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

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

11 Experts available now in Live!

Get 1:1 Help Now