473,508 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting tbl from external mdb with code

G'day, How can I DROP a table from an external database (mdb) use vba code?

Tony
Nov 13 '05 #1
1 1479
Tony wrote:
G'day, How can I DROP a table from an external database (mdb) use vba code?


Drop the link by using:
CurrentDb.Execute "drop table MyTable", dbFailOnError

Drop from another db by...

(air code)
Dim db as dao.database
set db = dbengine(0).opendatabase("MyExternalDb.mdb")
db.execute "drop table MyTable", dbFailOnError
db.close
set db=nothing

Notes:
You need a reference to DAO.
Won't let you drop a table referenced by foreign keys.

You can use ADO but will need to set a connection string, I easily
forget all the bumf that goes into ADO connection strings so I generally
use a DSN, which makes the code a bit more flexible if compiled (in VB)
or made into an MDE (in Access).

--
Pretentious? Moi?
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14001
by: al havrilla | last post by:
hi all what does the phrase: "scalar deleting destructor" mean? i'm getting this in a debug error message using c++ 7.1 thanks Al
6
4545
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
46
4367
by: DP | last post by:
hi, i've got a form, with a subform in it. i've got a delete button in the subform. the code i;ve got is; Private Sub cmdDeleteRecord_Click() msg = "Are you sure you want to delete this...
4
9803
by: john | last post by:
When leaving the main menu form I want to delete some temporary tables. The following code on the form's close works: DoCmd.DeleteObject acTable, "tmpEnvelop". But is it possible to change it so...
0
857
by: =?Utf-8?B?amltbjVkYw==?= | last post by:
I had a bad experience with backup software, which corrupted my backup on my external usb drive. I had to reinstall XP MCE from backup disks and reset my programs. I have deleted everything on the...
0
8825
debasisdas
by: debasisdas | last post by:
This thread contains some useful tips for using External tables. USING EXTERNAL TABLE ======================= 1.THE TABLE POINTS TO EXTERNAL FILE. IF DATA IS ALTERED IN THE EXTERNAL FILE,DATA...
2
1906
Parul Bagadia
by: Parul Bagadia | last post by:
I have written a code for deleting certain value from linklist; it's not working; where as i have written one for deleting a no., after given no. which works fine! I even debugged it; but invain;...
10
12464
by: H.S. | last post by:
Hello, I have class in which I am allocating space for a double array in the constructor. I use the double array twice in one of the methods and then delete that array in the class's destructor....
0
768
by: Terry Reedy | last post by:
Karl Kobata wrote: Please post code that works. Use cut and paste. Have you read the manual section on the del statement? Most programs use del rather sparingly. Most temporary objects...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.