Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / August 2006

Tip: Looking for answers? Try searching our database.

DDL SQL, DAO3.6, dbFailOnError

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Mueller - 15 Aug 2006 12:12 GMT
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
Allen Browne - 15 Aug 2006 12:27 GMT
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.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> 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
[quoted text clipped - 19 lines]
> Thanks,
> David
David Mueller - 15 Aug 2006 13:17 GMT
Oh yeah, that makes sense.  Thanks.

> If the table does not exist, the query statement fails.
> That's different from the action failing.
[quoted text clipped - 27 lines]
> > Thanks,
> > David
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.