On Error

Dillen

Registered User.
Local time
Today, 20:47
Joined
Jan 13, 2005
Messages
14
We are using a form to update a table which is on a SQL-server.
Sometime it happens that the record is not updated, but we don't see an error message (e.g. set a date to 31.12.2100)

How can we capture those errors?


Christof.
 
Comment the lines "ON ERROR GOTO". When you have an error, Access will pop a message.

You could also modify the code following the label when the "ON ERROR" points to with a "msgbox err.description".
 
There seems to be a misunderstanding.
No error really pops up (and therefore no error message).

So what's the trick to not suppress the error messages.


We open a form where the user can enter his data.
Pressing a SAVE button triggers DoCmd.Close

That's all.
Christof.
 
Have you, at any time, set the warnings to False?
 
Interesting.
We have a DoCmd.SetWarnings True in the save code.

In debug mode I get the error message (ODBC failed), but not in normal mode.

Any ideas?

Christof.
 
Really no idea out there to overcome this problem?
 
Wired

What is the exact error message you get in debug mode?
 
The code is as follows

DoCmd.SetWarnings True
DoCmd.Close


and after the DoCmd.Close we get the following error message

ODBC--call failed
[Microsoft][ODBC SQL Server Driver] Datefield overflow (#0)


Hope this helps.
 
If you are not seeing the error, you have an active error handler that is trapping the error but ignoring it. You'll need to modify the error handler so that it does the right thing for this error.
 
I came across this which was from 'Trevors MS Access' - fairly old, but may be of help.

Q...How can I trap a ODBC Error in VBA? All the VBA Err object returns is "ODBC Call Failed"


A....Use the DbEngine.Errors collection

Code:
Sub Update_TempLib()

    On Error GoTo ErrorTrap
' Executing connect code at this point
    
Exit_errortrap:
    Exit Sub

ErrorTrap:

    Dim myerror As Error
    For Each myerror In DBEngine.Errors
    With myerror
        If .Number <> 3146 Then
        MsgBox .Description
        End If
    End With
    Next
    
    Resume Exit_errortrap
            
End Sub

'Updated: 07/05/1998 - Sol Shapiro

Luck ... Peter
 
Pat,

I turned off all error handlers by commenting out all ON ERROR GOTO statements and still the error message is only showing up in Trace/Debug mode.

Are there any other ways to define error handlers?
 
Do you have "Break on all errors" set? The normal setting is "Break on unhandled errors". Look at Tools/Options from the VBA window.
 
I changed the setting to "Break on all errors" ... but no change!! :mad:
 
Make sure that every error handler displays error messages.
 
Pat,
still no progress
- "Break on all errors" is set
- all "on error" statements are commented out
- all "DoCmd.SetWarnings" are commented out

-> no change. Error does not pop up.

- just turn on error before the docmd.close

-> no change. Error does not pop up.

So, still the same problem
 

Users who are viewing this thread

Back
Top Bottom