I am trying to trap the error that raises when you attempt to query a database that does not exist. noted that DAO.DBEngine.Error.Count does contain the value of how many errors have happened. Just cant seem to catch the error so that It can be handled correctly, heres what I am trying to do so far
| Code: |
Private Sub CheckReferenceTable()
on DBEngine.Errors.Count < 1 goto referencehandler
sqlCommand = "Select * FROM [REFERENCE]"
DB.OpenRecordset sqlCommand
Exit Sub
ReferenceHandler:
sqlCommand = "CREATE TABLE [REFERENCE] ([TABLE NAME])": Set RS = DB.OpenRecordset(sqlCommand)
CheckReferenceTable
End Sub
|
NOte the on statement is theoretical to get the idea across
On Error Resume Next will not work in this instance.