Forcing ignoring errors from ADODB to Excel VBA -


i don't know if possible, figured i'd ask.

is there equivalent on error goto next adodb connections in excel vba?

i have stored procedure i'm calling using adodb.command object. problem is, if 1 statement in stored procedure throws error, entire process gets shut down. yes, that's appropriate in cases, in case, it's not big deal, i'd continue executing rest of stored procedure anyway.

on error goto 0 shows sql error message , gives options "end" or "debug".

on error resume next skips sql error message, silently cancels sql command , moves next vba statement.

any ideas?

edit: i've had request code. i'm not sure much, here:

on error goto 0  serverconnection.open "provider=msdasql.1;persist security info=true;extended properties="driver=sql native client;trusted_connection=yes;server=dbserver;database=database";"  dim sqlcommand adodb.command set sqlcommand = new adodb.command  sqlcommand     .activeconnection = serverconnection     .commandtext = "exec cachetables @cachetabletype1=true"     .commandtype = adcmdtext     .execute end  serverconnection.close  set sqlcommand = nothing set serverconnection = nothing 

i don't control stored procedure, unfortunately, reason it's throwing errors person wrote used raiserror statements tell user execution to. fine in sql server, understands "priority" flag , hence continues executing, vba appears consider errors same importance.

because processing of stored procedure taking place on db server, have have kind of error handling inside stored procedure. example try/catch block in tsql if using sql server:

begin try      { sql_statement | statement_block } end try begin catch      [ { sql_statement | statement_block } ] end catch [ ; ] 

http://msdn.microsoft.com/en-us/library/ms175976.aspx

alternatively break sprocs logical divisions , surround each call on error goto next blocks in vba. latter option pretty dirty hack though, believe.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -