1 / 10

Error Trapping Error Handling & other very practical uses for VBA in MS Access 2000 Part I

Error Trapping Error Handling & other very practical uses for VBA in MS Access 2000 Part I. What is VBA. Visual Basic for Applications Work with complex logic (Case, Loops…) Allows use of constants and variables Perform Transaction Processing Create and work with DB objects in code

hani
Télécharger la présentation

Error Trapping Error Handling & other very practical uses for VBA in MS Access 2000 Part I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Error TrappingError Handling&other very practical uses for VBA in MS Access 2000Part I

  2. What is VBA • Visual Basic for Applications • Work with complex logic (Case, Loops…) • Allows use of constants and variables • Perform Transaction Processing • Create and work with DB objects in code • Create libraries of user-defined functions • Call Windows API functions • Perform automation commands • Implement Error Handling and Error Trapping Error Handling - Part I

  3. What is an Error • Every form & report contains an Error event • Form engine and report engine differ • Triggered by interface or by the engine • Error numbers range from 5 to 32,767 • Errors in VBA, Access, Jet, SQL, Windows • “Application-defined or object-defined error” • Some Jet errors use symbol | as placeholder Error Handling - Part I

  4. Message displayed when Error Occurs Debug causes the VBE to appear Error Messaging Error Handling - Part I

  5. Types of Errors • Synchronous Errors • Errors while code is running • Predictable • Most errors occur this way • Asynchronous Errors • Errors while code is NOT running • Unpredictable • i.e. Out of memory, network, bad data Error Handling - Part I

  6. Error Commands • On Error • On Error Goto Error_Handler • On Error Resume Next • Exit • Exit Sub • Exit Function • Resume • Resume Next Error Handling - Part I

  7. Error Flow Error Handling - Part I

  8. Error Handling • Allow error to occur, then resume • Substitute error with code • Trap error and handle it • Bring up Message Box • Bring up Input Box • Bring up another form • Trap Error and Log to Errors Table Error Handling - Part I

  9. Conclusion • Errors Happen ! • Can not trap errors with macros – use VBA • Errors in VBA, Access, Jet, SQL, Windows • Handle all predictable errors • Handle many unpredictable errors • Handle all errors “elegantly” • Explore Nesting Error Handlers • Explore User-Defined Errors Error Handling - Part I

  10. Questions Error Handling - Part I

More Related