How do I retrieve an error description if there is no actual error. I know how to get it when an error is thrown - err.description. But say all I have is the error number like 3011.
You need to use AccessError for some (most) of the higher number error numbers.
When I type in AccessError(3011) I get this:
Code:
?accesserror(3011)
The Microsoft Jet database engine could not find the object '|'. Make sure the object exists and that you spell its name and the path name correctly.
In Access 2003, the highest error number is 10,973.
You can stuff them all into a table using something like:
tblAllErrors
============
id - AutoNumber
ErrorNumber - Long Integer
ErrorText - Memo
Code:
Dim i As Long
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Select * From tblAllErrors")
For i = 0 To 20000
rst.AddNew
rst!ErrorNumber = i
rst!ErrorText = AccessError(i)
rst.Update
Next i
Then if you remove all of the blank messages, you get 4,080.
Then remove "Application-defined or object-defined error" leaving 2,168.
I guess I can just get by with putting the error number in the msgbox. I'd just like to know if the error is one of a handfull which would give me a pretty good idea where the problem may be...