Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error traps not trapping

Status
Not open for further replies.

formerTexan

Programmer
Apr 10, 2004
504
US
Hello folks,

I am using two functions written (in A2K) to gracefully trap expected errors and accordingly return a boolean value. Instead things decompile, an error message pops up and code screeches to a halt at the lines marked >>>.

I see no reason here why the expected errors shouldn't be simply passed on to the error handling routine. Presumably another clue is that the problem so far only occurs on one computer and occured some time after the applications had already been in use. I still use the functions and applications without issues on other computers running both A2K and A2003.

I would appreciate any suggestions other than "pitch the computer".

Thanks
Bill

Public Function pfIsSubForm(frm As Form) As Boolean
' returns 0 if no parent form
Dim strName As String
On Error Resume Next
>>> strName = frm.Parent.Name
pfIsSubForm = (Err.Number = 0)
Err.Clear
End Function


Private Const cerrPropertyNotFound As Integer = 3270

Private Function GetProperty(ByVal strPropName As String, ByRef strPropValue As Variant) As Boolean
' Changed strPropValue as String to as Variant

Const cProcedureName As String = "GetProperty"
On Error GoTo Err_Handler
Dim db As DAO.Database

Set db = CurrentDb
>>> strPropValue = db.Properties(strPropName)
GetProperty = True

Exit_Sub:
On Error GoTo 0
Set db = Nothing
Exit Function
Err_Handler:
GetProperty = False
Select Case Err
Case cerrPropertyNotFound
Case Else
' Call LogError(Err.Number, Err.Description, cModuleName & cProcedureName)
End Select
Resume Exit_Sub
End Function
 
Problem resolved. Sorry for the false alarm. Posting is cathartic.

After unsuccessfully mulling this problem over for the past week, I had momentary spell of rational thought five seconds after posting the message. More or less obviously, it had to be something global since all apps on the machine were affected. Windows seemed a possible culprit, but Access a more likley one and perhaps it was something global on error trapping.

VBA window > Tools > Options > General and reset Error Trapping to "Break on Unhandled Errors".

Life is good again.

Cheers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top