On Error of an On Error

N

none

How do I write an On Error of an On Error? For example, if an error
occurs when trying to open a linked table, I would like to open up the
linked table manager for the user to link the tables properly.
However, if that is not installed, I would like to give the user a
error message that I will write. At the moment, my code which errs
out is as follows:

========================
Private Sub Form_Current()

' Checks to see if all table is there
On Error GoTo TableMgr

If (DCount("*", "qReport") > 0) Then
MsgBox "This should not be 0.", vbOKOnly, "Not 0"

End If

Exit Sub

TableMgr:
MsgBox "The Linked Table Manager will open.", vbOKOnly, "Table
Manager"
Application.Run ("acwztool.att_Entry")
On Error Resume Next 'GoTo NeedToInstallLinkedTableManager

NeedToInstallLinkedTableManager:
MsgBox "The Linked Table Manager needs to be installed.",
vbOKOnly, "The Linked Table Manager add-on needs to be installed."

End Sub

========================

Thank You!
 
N

none

Thank you for your reply. Unfortunately, I had a error in the code
that I was trying to run. So, basically, if it errs out because the
tables are not linked, it calls up the linked tables manager; if it
errs out because the linked tables manager is not installed, it gives
another message.

The code should have read:

========================
Private Sub Form_Current()

' Checks to see if all table is there
On Error GoTo TableMgr

If (DCount("*", "qReport") > 0) Then
MsgBox "This should not be 0.", vbOKOnly, "Not 0"

End If

Exit Sub

TableMgr:
MsgBox "The Linked Table Manager will open.", vbOKOnly, "Table
Manager"
Application.Run ("acwztool.att_Entry")
On Error GoTo NeedToInstallLinkedTableManager

NeedToInstallLinkedTableManager:
MsgBox "The Linked Table Manager needs to be installed.",
vbOKOnly, "The Linked Table Manager add-on needs to be installed."

End Sub

========================

However, this is not producing the behavior I was hoping for. It
gives me a debug error if it can't find the linked tables manager.
Thank you!
 
N

none

Thank you for the references, I will look them up. However, just for
my edification, if I should run into needing to have an error
statement from an error statement in the future, what is the syntax?
What signals the end of the first error statement so that I can have a
second error statement, without it giving me a debug error?

Thank you!
 
D

Douglas J. Steele

TableMgr:
MsgBox "The Linked Table Manager will open.", vbOKOnly, "Table
Manager"
On Error Resume Next
Application.Run ("acwztool.att_Entry")
If Err.Number <> 0 Then
MsgBox "The Linked Table Manager needs to be installed.",
vbOKOnly, "The Linked Table Manager add-on needs to be installed."
End If
 
Top