gjblackford
Registered User.
- Local time
- Today, 21:12
- Joined
- Jul 17, 2006
- Messages
- 10
Error Trapper Code only running in Debug Mode
Hi,
The function below works fine when I run in Debug mode, but when I run the code normally it fails with an Error 13 - Type Mismatch which the error trapper should stop, I have even added a debug.print statement to see if the Error Trapper is being called and it isn't. I have checked that I am on breaking on unhandled errors, so I am at a loss to why this is happening, does anyone have any ideas
Thanks,
Gavin,
Hi,
The function below works fine when I run in Debug mode, but when I run the code normally it fails with an Error 13 - Type Mismatch which the error trapper should stop, I have even added a debug.print statement to see if the Error Trapper is being called and it isn't. I have checked that I am on breaking on unhandled errors, so I am at a loss to why this is happening, does anyone have any ideas
Code:
Public Function RefreshContribution()
On Error GoTo RefreshContribution_Error
With Forms(CurrentForm)
MsgBox "point"
If !Contribution < 0 Then
MsgBox "point 1"
!Contribution.BackColor = 128
!Contribution.ForeColor = 16777215
!PercentContribution.BackColor = 128
!PercentContribution.ForeColor = 16777215
Else
MsgBox "point 2"
!Contribution.BackColor = IIf(CurrentForm = "AutoCost", 13434828, 10079487)
!Contribution.ForeColor = 0
!PercentContribution.BackColor = IIf(CurrentForm = "AutoCost", 13434828, 10079487)
!PercentContribution.ForeColor = 0
End If
End With
Exit Function
RefreshContribution_Error:
Debug.Print "Error Handler Reached"
If Err.Number = 13 Then
'ignore - no contribution available
Else
ErrorHandler
End If
End Function
Thanks,
Gavin,
Last edited: