DDL SQL, DAO3.6, dbFailOnError

D

David Mueller

My code works, but am I doing something slightly wrong? If the table
doesn't exist an error is raised. Notice, I didn't specify the dbFailOnError
option.

Is that normal behavior? Is it a difference between DDL and DML SQL, or
should I not be using a DAO workspace?

On error goto ...
Dim wsp As DAO.Workspace
Dim db_wsp As DAO.Database
Set wsp = DBEngine.Workspaces(0)
Set db_wsp = wsp(0)

wsp.begintrans
strSQL = "DROP TABLE MyTableName;"
db_wsp.execute strsql
wsp.committrans

set nothings, etc ....


Thanks,
David
 
A

Allen Browne

If the table does not exist, the query statement fails.
That's different from the action failing.

For example, if you use:
strSql "UPDATE Table1 SET Field99 = 0;"
but there is no field named Field99, the execute fails with a parameter
error, even if you don't use dbFailOnError.
 
D

David Mueller

Oh yeah, that makes sense. Thanks.


Allen Browne said:
If the table does not exist, the query statement fails.
That's different from the action failing.

For example, if you use:
strSql "UPDATE Table1 SET Field99 = 0;"
but there is no field named Field99, the execute fails with a parameter
error, even if you don't use dbFailOnError.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top