[AccessD] Odd property error

max.wanadoo at gmail.com max.wanadoo at gmail.com
Mon Nov 26 03:15:03 CST 2007


Function xProp()
  'SetFieldDescription = fld.Properties("Description")
  On Error GoTo errhandler
  ' property 'DESCRIPTION' for a FIELD does not exist unless user creates it
and it is creatable!
  Dim dbs As DAO.Database, tbldef As DAO.TableDef, fld As Field, prp As
Property
  Dim strDescription As String
  Set dbs = CurrentDb
  Set tbldef = dbs.TableDefs("Explains")
  For Each fld In tbldef.Fields
    For Each prp In fld.Properties
      If prp.Name = "Description" Then
        strDescription = prp.Value
      End If
    Next prp
  Next fld
exithere:
  Set dbs = Nothing: Set tbldef = Nothing: Set fld = Nothing: Set prp =
Nothing
  Exit Function
errhandler:
  Select Case Err.Number
    Case 3219, 3267, 3251 ' invalid operation type errors
      If prp.Name = "Description" Then
      ' You should never arrive here because the prp.name of 'Description'
does not exist if it not creatable.
        strDescription = fld.Name & " " & prp.Name & " No Description Held"
        MsgBox strDescription
      End If
      Resume Next
    Case Else
      MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
  End Select
  Resume exithere
End Function 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Monday, November 26, 2007 1:29 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Odd property error

I'm using the following statement to retrieve the description properties for
query fields:

SetFieldDescription = fld.Properties("Description")

As long as there's a description, it works fine. An empty property returns
the error "property not found"

I've tried a Resume Next error statement, but VBA acts like it isn't even
there and still returns the error.

I've tried numerous ways to avoid or capture it, and nothing's worked.

As far as I know, Description isn't user-defined and I think VBA's just
returning one of its many, famous erroneous error messages that aren't so
terribly helpful. However, you'd think Resume Next would ignore it, but it
doesn't seem to.

Anyone seen anything like this before?

I haven't tried a real error handling routine because I'd hoped to avoid
doing so if there was an easier solution.

Susan H. 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list