Rabu, 05 April 2017

[MS_AccessPros] Error Handling MS Template

 

For my education, I am trying to convert some MS templates from macros to code.  Can someone explain why the various MS template subs have two different error handling statements, one after the other, as below?  What error would the first error statement handle?  I assume the first error statement gets turned off as soon as the code reaches the second error statement?

'Private Sub cmdPrint_Click()
'On Error GoTo cmdPrint_Click_Err
'
'
'    On Error Resume Next
'    If (Form.Dirty) Then
'        DoCmd.RunCommand acCmdSaveNow
'    End If
'    If (MacroError.Number <> 0) Then
'        DoCmd.Beep
'        MsgBox MacroError.Description, vbOKOnly, ""
'        Exit Sub
'    End If
'    On Error GoTo 0
'    If (IsNull(ID)) Then
'        DoCmd.Beep
'        Exit Sub
'    End If
'    TempVars.Add "FIlterID", ID.Value
'    DoCmd.Close , ""
'    DoCmd.OpenReport "Task Details", acViewReport, "", "[TaskID]=" & TempVars!FilterID, acNormal
'    DoCmd.RunCommand acCmdPrint
'    DoCmd.OpenForm "frmTaskDetails", acNormal, "", "[TaskID]=" & TempVars!FilterID, , acNormal
'    TempVars.Remove "FIlterID"

'cmdPrint_Click_Exit:
'    Exit Sub
'
'cmdPrint_Click_Err:
'    MsgBox Error$
'    Resume cmdPrint_Click_Exit
'
'End Sub


__._,_.___

Posted by: david.pratt@outlook.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar