formerTexan
Programmer
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
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