BrokenBiker
ManicMechanic
- Local time
- , 19:12
- Joined
- Mar 22, 2006
- Messages
- 128
I've been working on some update utilities which I've figured out pretty well, but I'd like some better error trapping. These utilities are being e-mailed out to the various locations (not connected by a common LAN & not web-based) and I'd like to create a table listing any errors received during the update so I can see exactly where the problem lies.
I found this thread which looks like what I need, but I can't can't find how to do it.
I purposely created some errors to receive the error numbers (7874 & 3011), so I'll have the Case for the code. I just can't figure out how to transfer the object which caused the fail to a table.
If, for instance, Access can't find the object "Employee Table" I receive the error# 3011 (or error# 7874 for the DeleteObject line), can I have Access enter the object name into a table?
If this can be done, then I can simply make some code to export the table and then create an email for the user to send the file back to me.
I found this thread which looks like what I need, but I can't can't find how to do it.
Code:
Funtion ImportTextFiles() --this would be whatever your function name is
On Error Goto Err_ImportTextFiles
'Below is a snippet of my code--the whole utility uses this delete/import design
DoCmd.DeleteObject acQuery, "Employee Query"
DoCmd.TransferDatabase acImport, "Microsoft Access", strPath, acTable, "Employee List TableXXX", "Employee List TableXXX", False
Exit_ImportTextFiles:
Exit Function
Err_ImportTextFiles:
Select Case Err.Number
Case 3011
*do something here if you want to log the error
*don't use a msgbox as it will stop the code and wait for the
*user to click OK
Resume Next
Case Else
Resume Exit_ImportTextFiles
End Select
End Function
I purposely created some errors to receive the error numbers (7874 & 3011), so I'll have the Case for the code. I just can't figure out how to transfer the object which caused the fail to a table.
If, for instance, Access can't find the object "Employee Table" I receive the error# 3011 (or error# 7874 for the DeleteObject line), can I have Access enter the object name into a table?
If this can be done, then I can simply make some code to export the table and then create an email for the user to send the file back to me.