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

Field Attributes

Status
Not open for further replies.

MichaelRed

Programmer
Dec 22, 1999
8,410
US
exploring the table.field.properties

ONE of the properties is "Attributes"

Two of the attributes APPEAR to have the same value?

from the Object Browser --> DAO --> FieldAttributeEnum

? dbDescending
1
? dbfixedfield
1

huh?

Which guru can provide some insight into this?

How might one distinguish the value?



MichaelRed


 
Perhaps I could be a bit clearer? Look at the 'code' below. In the comment block / section, note the two lines in Bold. Any hints or help in seeing how to distinguish theese would be greatly appreciated.


Code:
Public Function basShowFieldAttributes()

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim tdf As TableDef

    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs("tblDocufields")

    Debug.Print "dbAutoIncrField = " & dbAutoIncrField & Space(5) & "(" & Hex(dbAutoIncrField) & ")"
    Debug.Print "dbdescending = " & dbDescending & Space(5) & "(" & Hex(dbDescending) & ")"
    Debug.Print "dbFixedField = " & dbFixedField & Space(5) & "(" & Hex(dbFixedField) & ")"
    Debug.Print "dbHyperlinkField = " & dbHyperlinkField & Space(5) & "(" & Hex(dbHyperlinkField) & ")"
    Debug.Print "dbSystemField = " & dbSystemField & Space(5) & "(" & Hex(dbSystemField) & ")"
    Debug.Print "dbUpdatableField = " & dbUpdatableField & Space(5) & "(" & Hex(dbUpdatableField) & ")"
    Debug.Print "dbVariableField = " & dbVariableField & Space(5) & "(" & Hex(dbVariableField) & ")"

    'From which I / we get _
    basShowFieldAttributes _
    dbAutoIncrField = 16     (10) _
    [b]dbdescending = 1     (1) _
    dbFixedField = 1     (1) [/b] _
    dbHyperlinkField = 32768     (8000) _
    dbSystemField = 8192     (2000) _
    dbUpdatableField = 32     (20) _
    dbVariableField = 2     (2)

End Function

Michael Red

MichaelRed


 
As I understand it, dbdescending only applies to indexes, while dbfixedfield applies to fields.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Howdy MichaelRed . . .

Agree with [blue]traingamer[/blue]. It appears it has to do with the context with which their used.

[purple]dbdescending[/purple] obviously prescribes an [blue]Order By[/blue] method.

[purple]dbfixedfield[/purple] prescribes a [blue]fixed string data type[/blue] as in a make table query.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
thoughts? you think I have THOUGHGTS?

not thoughts, just questions. Who really cares what these apply to? I want to know HOW to distinguish the values. The are both ATTRIBUTES of table fields. The (to me at least) APPEAR to have the same value. As you are aware, ATTRIBUTES are the binary tree facet of many structures. Each "Bit" of the value represents some 'article' of the set of attributes. But, and this is the critical question, how does one seperate the values 'dbdescending' and 'dbFixedField' using the typical Mask approach?

Does one need to look at the Access DataType PROPERTY? If so, which if these attributes appply to which DataTypes? I can easily imagine dbDescending to be applicable to all field data types, while not clearly seeing dbFixedField applying to any.

Actually, many of these Attributes seem, to me, to me implausable. What does 'dbSystemField' even mean? And when / where (what DataType) would it be appl to? dbVariableField would SEEM to only be applicable ONLY to text fields, but there it would seem to universally apply?

These are, however, at least uniquely identifiable and thus not of immediate concern.

In short, are you, or anyone available, able to concisely and concretly tell me how to decide WHICH attribute of the field when the attributs &H1 rerturns True?

MichaelRed



MichaelRed


 
Michael,
I do not understand your confusion the traingamer and aceman both answered it, but maybe this will help. First if you read this
you would understand better. It clearly talks about this, and evens answers that dbsystemfield is for a replication property.

But this may help. Build a table with two fields, an auto increment field and a fixed field. Give each an index.
Code:
Public Sub testAttributes()
  Dim tdf As DAO.TableDef
  Dim fld As DAO.Field
  Dim idx As DAO.Index
  Dim db As DAO.Database
  Set db = CurrentDb
  Set tdf = db.TableDefs("tblOne")
  For Each fld In tdf.Fields
    Debug.Print fld.Name & " " & fld.Attributes
  Next fld
  For Each idx In tdf.Indexes
    For Each fld In idx.Fields
      Debug.Print "IDX " & fld.Name & " " & fld.Attributes
    Next fld
  Next idx
End Sub
[code]

So what would you expect for a print out?
auto increment: 16
descending: 1
ascending: 0
fixed 1:

So as expected:

autoID 17    (16 autofield + 1 descending)
fixedField 2 (1 for fixed and 1 for descending)

IDX autoID 1  (its a fld of an index its is either 0 or 1)
IDX fixedField 1

so clearly there is no ambiguity.
 
Sorry I did my math wrong.
The dbdescending is not added to the field attributes.

I should have had
17: 16 auto increment and 1 fixed
2: Was because I messed up and it was actually a text field being varable
1: When I changed it to fixed it gets one.

so bottom line the dbdescending is only an attribute of an index field, and the other attributes are not attributes for and index.
 
MichaelRed . . .

For all the years I've never heard you speak with the type of demeanor used in your post [blue]21 May 11 9:55[/blue]. Really surprising ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
FYI,
Here is a good post on bit masking to determine these parameters. Some nice code and good explanation.

I am also a little confused on the attribute dbUpdateableField = 32. The definition is "the field value can be changed". However no field I tested returns this property, and my assumption would be all. The thread above seems to hint that this if the table is created in code it will get the 32 but once appended to the table defs this attribute is not returned. Anyone have clarity on this?

Also my last post was a little confusing, as I went back and read it. But these are the correct values if adding a autonumber, numeric, text field, hyperlink to a table (using the Access gui not code).

auto increment field: returns 17 (16 for increment + 1 for fixed size)
text field: returns 2 (text fields are variable)
numeric field: returns 1 (numeric fields are fixed fields by default)
hyperlink field: returns 32770 (32768 for the hyperlink + 2 for variable)

(no idea about updateable because it does not appear to show up and maybe it means something different than I think)

The dbdescending has not impact above because it is only an attribute of a field returned from and index collection.

Field attributes of index fields only return a 0 (ascending) or 1 (descending). The other constants are not included in the atrributes of the index field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top