Thanks, but i guess i wasnt clear on my problem.
I dont need to trap the error, I still want to set the value of the table
descriptions, but its giving me an error saying the property isnt available
for that table. Is there a way of ensuring i set the property whether or not
there is a description currently.
Thanks,
Ben
> Use error handling to trap the error (3270 from memory).
>
[quoted text clipped - 30 lines]
> > Thanks for any help!
> > ben
If it is not available, then you can CreateProperty.
Here's a function you can use that sets the property if it exists, and
creates and sets it if it does not exist.
Example:
Call SetPropertyDAO(Currentdb.TableDefs("MyTable").Fields("MyField"), _
"Description", dbText, "This is my description")
Function SetPropertyDAO(obj As Object, strPropertyName As String, _
intType As Integer, varValue As Variant, Optional strErrMsg As String) As
Boolean
On Error GoTo ErrHandler
'Purpose: Set a property for an object, creating if necessary.
'Arguments: obj = the object whose property should be set.
' strPropertyName = the name of the property to set.
' intType = the type of property (needed for creating)
' varValue = the value to set this property to.
' strErrMsg = string to append any error message to.
If HasProperty(obj, strPropertyName) Then
obj.Properties(strPropertyName) = varValue
Else
obj.Properties.Append obj.CreateProperty(strPropertyName, intType,
varValue)
End If
SetPropertyDAO = True
ExitHandler:
Exit Function
ErrHandler:
strErrMsg = strErrMsg & obj.Name & "." & strPropertyName & _
" not set to " & varValue & ". Error " & Err.Number & " - " & _
Err.Description & vbCrLf
Resume ExitHandler
End Function
Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Thanks, but i guess i wasnt clear on my problem.
>
[quoted text clipped - 45 lines]
>> > Thanks for any help!
>> > ben