Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error routine
Message
 
 
À
16/07/2002 13:19:14
Information générale
Forum:
Visual Basic
Catégorie:
Access
Titre:
Divers
Thread ID:
00679201
Message ID:
00679323
Vues:
19
However, is there a way to create a generic routine that all forms within Access could use as an errorhandler? VisFox can simply call a routine for any error. At this point, I would have to introduce on error statements and duplicate logic for dozens of forms (unless I'm missing something from the documentation).

the documentation states that the program will look through calling programs for error-handling routines. I have a form that is a menu with buttons calling other forms. In the click event of a button, I added the on error statement and routine. However, when an error occurs within the load proc of the child form, I get the generic routine. Any suggestions?

Thanks


>In VB, sample error trapping routine looks like this:
>
>
>Sub SampleSub()
>
>On Error GoTo ErrorHandler
>
>  [normal code for SampleSub]
>
>SampleSubExit:
>  Exit Sub  'If no error is generated, error code bellow must not be executed
>
>ErrorHandler:
>  [Error-handling code]
>  Select Case Err.Number
>    Case [Some error number]
>      [handling code]
>    Case [Some error number]
>      [handling code]
>........................
>    Case [Some error number]
>      [handling code]
>    Case Else
>      [handling code]
>  End Select
>  Resume SampleSubExit  'Go to exit from sub
>End Sub
>
>
>If no error is generated, sub will end at Exit Sub statement. If an error occurs, you must detect what is this error (through Select Case statement) and do appropriate actions. Then most often sub ends.
>For every Case you can resume executing from different place (you must put label on place where code will resume).
>There are also On Error Resume Next statement instead of GoTo [label] (to skip failed row) or On Error Resume Statement (to retry). Read MSDN for these statements.
Steve Howie, owner
DaSH Technology
Denver, CO
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform