473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Delete a table only if it exists

34
Hi,

Sometimes, when my table is imported, there are blank cells and an ImportError table gets created in Access.
That table needs to be deleted. But the problem is that if I put the code in:

Expand|Select|Wrap|Line Numbers
  1.   DoCmd.DeleteObject acTable, "Agri_Futures_9196$_ImportErrors"  
and the table doesn't exist, an error message is popping up.

What do I need in my IF statement to cater for this?

Thanks,
R
Dec 18 '07 #1
1 4880
Dan2kx
365 100+
Could you put on error resume next?
Dec 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jonathan | last post by:
I am looking for a simple way to check if a database table exists. I keep getting advice to use "Try.. Catch" and other error handling methods, but I obviously don't want to have to display an...
3
by: DottingTheNet | last post by:
i promise no more silly questions after this but how do i check if a table exists?? it is my understanding that the exists can only be used in the where clause of the query. i just want s'thing...
2
by: fad | last post by:
Thanks for you Aaron but this code works with VBSCRIPT and I don't Know how to convert it to javascript>>>I want it with javascript not with VBSCRIPT -- fad...
2
by: Rotsj | last post by:
Hi, if i run the following query: select * from std_order_lines sol where exists(select * from std_orders so, customers c where so.customers_id = c.customers_id and c.test_customer = 'Y' and...
3
by: Michael Magg | last post by:
Hello! I wanna import a table with a makro, but a table with this name already exists. So the imported table (f. i. "table") is saved as "table1". How can I check, if such a table already exists...
10
by: Geoff Jones | last post by:
Hi I'm trying to drop a table by using: Dim cmd As New OleDbCommand("DROP TABLE IF EXISTS books", myconnection) cmd.ExecuteNonQuery() but I get a syntax error: "Syntax error in DROP TABLE...
5
by: phillip.s.powell | last post by:
$sql = "SELECT IF((SHOW TABLES LIKE '$subselectTableName'), count(*), NULL) AS numRows FROM $subselectTableName"; I am trying to write a SQL statement that will tell me if a table exists or not,...
2
by: Scott | last post by:
I have a macro set up to delete a table and then it imports an up-to-date copy of the table. Every once in a while the table gets deleted but the new one isn't imported, I assume the user is...
2
by: Dan2kx | last post by:
Is there a line of code i could use to check if a table exists (so that i can delete it if it does) im thinking If table1 = true then etc thanks Dan
5
by: bbatson | last post by:
Hello, I have a batch of code that imports data from an Excel file to an Access table. Sometimes the import creates a table with import errors and sometimes it does not. I would like the code to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.