What I would like to do is return nice message like "SPS is not connected"
is case of such event. How to do this?
One way is to catch the error event and fire a function on error. The other
is check if table exists before running the update. But how to do this?
Thnx
Pawel
Sub xx()
Dim tdf As TableDef
On Error GoTo 0
On Error Resume Next
Set tdf = CurrentDb.TableDefs("NonExistTableName")
MsgBox Err.Number ''will be 3265
On Error GoTo 0
On Error Resume Next
Set tdf = CurrentDb.TableDefs("ExistingTableName")
MsgBox Err.Number 'will be 0
Set tdf = Nothing
End Sub
I got this from this NG:
Public Function IsTable(strTable As String) As Boolean
Dim tdf As TableDef
IsTable = False
For Each tdf In CurrentDb.TableDefs
If tdf.Name = strTable Then
IsTable = True
Exit For
End If
Next tdf
End Function
James A. Fortune