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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relation Attribute Enum 1

Status
Not open for further replies.

MichaelRed

Programmer
Dec 22, 1999
8,410
US
Trying to document the relationships. I can get the process to work, but cannot find the COMPLETE Attributes Enum.

the code to dump this into a recordset:
Code:
Public Function basAllRelations()

    Dim dbs As DAO.Database
    Dim relLoop As Relation
    Dim rst As DAO.Recordset
    Dim relName As String
    Dim Idx As Integer

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("tblRelations", dbOpenDynaset)

    'Clear previous content
    DoCmd.SetWarnings False
        DoCmd.RunSQL "Delete * From tblRelations;"
    DoCmd.SetWarnings True

    'Enumerate the Relations collection. _
     Record the property values of the Relations and their Fields.
    For Each relLoop In dbs.Relations
        With relLoop
            relName = .Table & ":" & .ForeignTable
            Idx = 0
            While Idx <= .Fields.Count - 1
                rst.AddNew
                    rst!db = dbs.Name
                    rst!Relation = relName
                    rst!Primary = .Table & "." & .Fields(Idx).Name
                    rst!Foregin = .ForeignTable & "." & .Fields(Idx).ForeignName
                    Idx = Idx + 1
                    rst!Attrib = relLoop.Properties("Attributes")
                rst.Update
            Wend
        End With
    Next relLoop

    dbs.Close

End Function

The object Browser shows the Attributes ENum as :
1:[tab][tab][tab][tab]Unique
2:[tab][tab][tab][tab]Dont enforce
4:[tab][tab][tab][tab]Inherited
256:[tab][tab][tab]UpdateCascade
33554432:[tab]Right
1777216:[tab]Left

The aactual values include:
4:[tab][tab][tab]Inherited
6:[tab][tab][tab]Inherited + Dont Enforce
7:[tab][tab][tab]Unique + Inherited + Dont Enforce
260:[tab][tab][tab]Inherited + Update Cascade
4356:[tab][tab][tab]WHAT IS THIS


Examining the "Attrib" field after executing the procedure,

MichaelRed


 
Name Value Description
dbRelationDeleteCascade 4096 Deletions cascade
dbRelationDontEnforce 2 Relationship not enforced (no referential integrity)
dbRelationInherited 4 Relationship exists in the database containing the two linked tables
dbRelationLeft 16777216 Microsoft Access only. In Design view, display a LEFT JOIN as the default join type.
dbRelationRight 33554432 Microsoft Access only. In Design view, display a RIGHT JOIN as the default join type.
dbRelationUnique 1 One-to-one relationship
dbRelationUpdateCascade 256 Updates cascade

So 4356 is delete cascade + update cascade + inherited?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
thanks for the info. Looks like you have one more than I did (4096). May I ask where you found this one?




MichaelRed


 
In the object browser: RelationAttributeEnum
(ac2003, DAO 3.6)
 
thanks to both, I must have an out of date something ...



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top