How can I examine an error code from ODBC and Oracle
using VBA?
if I use form_error, I can trap the error but dataerr gives me the code 7786 for different errors.
Printable View
How can I examine an error code from ODBC and Oracle
using VBA?
if I use form_error, I can trap the error but dataerr gives me the code 7786 for different errors.
Id you Lookup ODBC Errors youll Fin that there is an err code number block assigned to odbc.
Rather than using access form method try this:
Private sub MysubName
On Error Goto MySubNameErr
'You normal code goes in here
'eg..Test this by using didvision by 0
dim int1,int2 as integer
dim intAns as integer
int1 = 5
int2 = 0
intAns = int1/int2
Exit sub (or exit function for function)
Msgbox err.Number & "- " & vbcrlf & Err.Description,Vbinformation,"Error Trap Example"
Err.Clear
'then decide on Resume next or Exit Sub
'generally I exit sub so it doesnt have a chance to create more errors
End Sub