473,785 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateQ ueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedField s 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 8861
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.c a> 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.CreateQ ueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedField s 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.Tablede fs.Refresh

(david)

"Mike Preston" <mb************ **@pacbell.net> wrote in message
news:41******** ********@news.I NDIVIDUAL.NET.. .
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.c a> 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.CreateQ ueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedField s 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********@hot mail.com> wrote in message
news:bf******** *************** **@posting.goog le.com...
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.I NDIVIDUAL.NET.. .
On Tue, 17 Aug 2004 14:52:00 -0400, "Andrew" <an****@abc.c a> 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.CreateQ ueryDef("", _
"CREATE TABLE " & sTableName & " (DelimitedField s 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
5055
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, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
7
8667
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= 'select * from %s where cusid like %s ' Cursor.execute(sql,(name,recID))
9
9530
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
12420
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 provided by Informix. This is the problem: the execution of the translated SQL leaves the rows in the temp table correctly but raises error SQL0480N. It's very simple to try it: ------------
3
4814
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 module that creates 5 queries (that a report is based on) based on a table that the user defines. My tables are named by date (not my choice), for example: -ArchivedActions05-20-05 Everything involving that seems fine. I'm getting a syntax error...
2
3338
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 clearer explanation... Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have put Server.Execute("Path to Page1 in WebApp1"). When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.aspx", everything works ok...
8
3533
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 error in FROM clause. I'm supposing that it won't create the query because it analyzes the SQL string and determines that there is a syntax error in the FROM clause of the query I am trying to create. The odd thing is that if I take this same SQL...
2
2935
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 and integrate into their Dbs. Following is my script and is launched On_Open event. The script determines someone's desired upload class (test, archive or recent), executes a specific query based on that info, then writes the query results to a...
6
2493
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 which needs to be converted into ADP. Any kind of help would be highly appreciated. Below is the snippet of code: Dim Db As DAO.Database
0
10357
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.