473,385 Members | 1,848 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,385 software developers and data experts.

CreateQueryDef and Execute

Hi:

I run into the following problem where I would use CreateQuerydef to create
a new Table and then use "Execute" to execute the statement. However, I
keep getting an error message saying that the table already exists! (Error
3010 Table already exists). But I made sure that the table were dropped
before I executed the statement and I went into the database to check that
the table was deleted before I ran the "execute" statement. Here are my
codes:

On Error Resume Next
sSql = "Drop Table " & sTableName
conData.Execute sSql

Set qdf = conData.CreateQueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedFields TEXT 255))")
qdf.Execute
Can somebody please tell me why I keep getting the error message ( Error
3010 Table already exists )?

Nov 13 '05 #1
5 8845
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.ca> wrote:
Hi:

I run into the following problem where I would use CreateQuerydef to create
a new Table and then use "Execute" to execute the statement. However, I
keep getting an error message saying that the table already exists! (Error
3010 Table already exists). But I made sure that the table were dropped
before I executed the statement and I went into the database to check that
the table was deleted before I ran the "execute" statement. Here are my
codes:

On Error Resume Next
sSql = "Drop Table " & sTableName
conData.Execute sSql

Set qdf = conData.CreateQueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedFields TEXT 255))")
qdf.Execute
Can somebody please tell me why I keep getting the error message ( Error
3010 Table already exists )?
Probably not. But you can probably figure it out yourself by dropping
the line:
On Error Resume Next


from the above.

mike
Nov 13 '05 #2
conData.Tabledefs.Refresh

(david)

"Mike Preston" <mb**************@pacbell.net> wrote in message
news:41****************@news.INDIVIDUAL.NET...
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.ca> wrote:
Hi:

I run into the following problem where I would use CreateQuerydef to createa new Table and then use "Execute" to execute the statement. However, I
keep getting an error message saying that the table already exists! (Error3010 Table already exists). But I made sure that the table were dropped
before I executed the statement and I went into the database to check thatthe table was deleted before I ran the "execute" statement. Here are my
codes:

On Error Resume Next
sSql = "Drop Table " & sTableName
conData.Execute sSql

Set qdf = conData.CreateQueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedFields TEXT 255))") qdf.Execute
Can somebody please tell me why I keep getting the error message ( Error
3010 Table already exists )?


Probably not. But you can probably figure it out yourself by dropping
the line:
On Error Resume Next


from the above.

mike

Nov 13 '05 #3
total shot in the dark, but did you try refreshing the tabledefs
collection after the delete?
Nov 13 '05 #4
Hi:

Thanks for replying. I figured out it didn't work. It was my mistake!! I
incorrectly placed the Create Table statement within a For - Loop.
Obviously, the first time around the loop, the table was successfully
created. The second time around the loop, the table is already there and
hence the "Error Message".

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf*************************@posting.google.co m...
total shot in the dark, but did you try refreshing the tabledefs
collection after the delete?

Nov 13 '05 #5
Hi:

Thanks for replying. I figured out it didn't work. It was my mistake!! I
incorrectly placed the Create Table statement within a For - Loop.
Obviously, the first time around the loop, the table was successfully
created. The second time around the loop, the table is already there and
hence the "Error Message".
"Mike Preston" <mb**************@pacbell.net> wrote in message
news:41****************@news.INDIVIDUAL.NET...
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.ca> wrote:
Hi:

I run into the following problem where I would use CreateQuerydef to createa new Table and then use "Execute" to execute the statement. However, I
keep getting an error message saying that the table already exists! (Error3010 Table already exists). But I made sure that the table were dropped
before I executed the statement and I went into the database to check thatthe table was deleted before I ran the "execute" statement. Here are my
codes:

On Error Resume Next
sSql = "Drop Table " & sTableName
conData.Execute sSql

Set qdf = conData.CreateQueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedFields TEXT 255))") qdf.Execute
Can somebody please tell me why I keep getting the error message ( Error
3010 Table already exists )?


Probably not. But you can probably figure it out yourself by dropping
the line:
On Error Resume Next


from the above.

mike

Nov 13 '05 #6

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

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
7
by: William Gill | last post by:
I have been trying to pass parameters as indicated in the api. when I use: sql= 'select * from %s where cusid = %s ' % name,recID) Cursor.execute(sql) it works fine, but when I try : sql=...
9
by: PyPK | last post by:
Hi if I have a function called tmp=0 def execute(): tmp = tmp+1 return tmp also I have def func1(): execute() ....
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
3
by: priscilla.jenkins | last post by:
Alright, I'm really new to SQL and VBA and all this, so I might be completely off course...but just tell me. I know C and Assembly, but that doesn't help me much here. I'm trying to create a...
2
by: Dune | last post by:
I'm trying to execute an aspx page by calling Server.Execute. The aspx page I'm trying to execute is in a different web app from the aspx page containing the Server.Execute statement. A slightly...
8
by: Expat | last post by:
I have several queries that I create from SQL statements using Currentdb.CreateQueryDef in one of these cases the code breaks and refuses to create the query giving me a: Run-time error 3131. Syntax...
2
by: oh4real | last post by:
Howdy all. I have pretty much NO VB/Access coding experience, but am forced to come up with a generic script/process for users with varying database designs and varying levels of expertise to use...
6
by: rahuldev999 | last post by:
Hi I am beginner in the access project. can anyone suggest how to deal with this " Set rq = Db.CreateQueryDef("r_temp_rslt_research", strSql)" in the below code.As its a MDB application...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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,...

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.