advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ERR Statement Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 ERR = n%
 
 Usage Notes
   ■ When running an application program, Visual Basic uses ERR to record
     whether a run-time error has occurred and what the error was. When the
     program starts running, ERR is 0; when and if a run-time error occurs,
     Visual Basic sets ERR to the error code for that error.
 
   ■ Use the ERR statement to set ERR to a nonzero value to communicate error
     information between procedures. For example, you might use one of the
     run-time codes not used by Visual Basic as an application-specific error
     code.
 
   ■ Besides the ERR statement, the following Visual Basic statements set ERR
     whenever they execute:
 
         This Statement...           Sets ERR to...
         ═══════════════════════     ═══════════════════════════════════════
         Any form of RESUME          0
         EXIT SUB, EXIT FUNCTION,    0 (if executed within a procedure-level
         or EXIT DEF                 error handler)
         All uses of ON ERROR or     0
         ON LOCAL ERROR syntax       0
         ERROR                       Any value (as part of simulating any
                                     run-time error)