access vba - what is the VBA for the USING statement -


in csharp or vb.net use using statement reasons know: 1 can open database , close automatically without writing explicitly. samething in vba

  1. how it?
  2. are vb.net statement/keywords/ available in vba ?
  3. how tell if given statement is(was) known in vba ? there library(glosary) of vba statements/keyword/operators ?

c#

  using(var db=new mydbcontext()){    //do work here   } 

vb.net

    using s = new mydbcontext()      '--..do work here     end using 

answering first question, you've hinted, using syntactic sugar calling dispose() on object instance implements idisposable interface.

it equivalent to

dim s mydbcontext try    s = new mydbcontext()    // ...    s.dispose() end try 

since vba doesn't support using sugar, , in absence of structured try..catch exception handling, you'll need explicitly call dispose() on paths control lifespan of object (mydbcontext in case). in case may have used .close()


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -