DDL SQL, DAO3.6, dbFailOnError

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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.
 
Back
Top