By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

CreateQueryDef and Execute

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
total shot in the dark, but did you try refreshing the tabledefs
collection after the delete?
Nov 13 '05 #4

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.