append property

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johm

    append property

    I am trying to append a property to the object Validation rule in the field
    branch1 of the table products.I then get the message
    "Cannot append. An object with the same name exists in
    the collection"
    It is true that the object ValidationRule exists in the field.However i want to
    make the validation rule to be >0 and i cannot make it.I receive the above error

    May i ask for help as to where is in my function ?


    Public Function Validate()
    Dim dbs As DAO.Database
    Set dbs = CurrentDb
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim prp As DAO.Property
    Set tdf = dbs.TableDefs(" products")
    Set fld = tdf.Fields("bra nch1")
    Set prp = fld.CreatePrope rty("Validation Rule", dbText, ">0")
    fld.Properties. Append prp
    dbs.Close
    Set prp = Nothing
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    End Function
  • Bas Cost Budde

    #2
    Re: append property

    Johm wrote:
    [color=blue]
    > I am trying to append a property to the object Validation rule in the field
    > branch1 of the table products.I then get the message
    > "Cannot append. An object with the same name exists in
    > the collection"
    > It is true that the object ValidationRule exists in the field.However i want to
    > make the validation rule to be >0 and i cannot make it.I receive the above error
    >[/color]
    If the ValidationRule property already exists, cannot you simply assign
    to it? like

    fld.ValidationR ule = ">0"

    ?

    --
    Bas Cost Budde

    but the domain is nl

    Comment

    Working...