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!

Property Problem 1

Status
Not open for further replies.

RonRepp

Technical User
Feb 25, 2005
1,031
US
Hi all:

For full code, see thread707-1576485.

I am populating a listview with the Field Names and properties from an Access DB (2003). I pulled the property part of this code straight from the help file, but it isn't correct. Mainly, I have an Autonumber key field called "ID" that doesn't seem correct.

Here is the portion of the code that adds to Listview and then gets the properties.
Code:
While Not FieldsRS.EOF
        If FieldsRS.Fields(2) = TV1.SelectedItem.Text Then
            Set LI = LV1.ListItems.Add(, , FieldsRS(3), 2, 2)
            
            IntType = GetFieldType(FieldsRS.Fields(2), FieldsRS(3))
            LI.SubItems(1) = GetFieldTypes(IntType)
            
           [b][COLOR=blue] FieldOutput FieldsRS.Fields(2), FieldsRS.Fields(3)[/color][/b]

This is the Help procedure:

Code:
Sub FieldOutput(strTemp As String, fldTemp As Field)
   ' Report function for FieldX.

   Dim prpLoop As Property

   Debug.Print "Valid Field properties in " & strTemp

   ' Enumerate Properties collection of passed Field
   ' object.
   For Each prpLoop In fldTemp.Properties
      ' Some properties are invalid in certain
      ' contexts (the Value property in the Fields
      ' collection of a TableDef for example). Any
      ' attempt to use an invalid property will
      ' trigger an error.
      On Error Resume Next
      Debug.Print fldTemp & "  " & prpLoop.Name & " = Attributes: " & _
         prpLoop.Attributes & " - Type: " & prpLoop.Type & " - Value: " & prpLoop.Value
      On Error GoTo 0
   Next prpLoop

End Sub

Here are the results for ID:
[code>>Column ID]
ID BASECOLUMNNAME = Attributes: 1 - Type: 202 - Value:
ID BASETABLENAME = Attributes: 1 - Type: 202 - Value:
ID BASECATALOGNAME = Attributes: 1 - Type: 202 - Value:
ID BASESCHEMANAME = Attributes: 1 - Type: 202 - Value:
ID KEYCOLUMN = Attributes: 1 - Type: 11 - Value: False
ID ISAUTOINCREMENT = Attributes: 1 - Type: 11 - Value: False
ID RELATIONCONDITIONS = Attributes: 1 - Type: 204 - Value:
ID CALCULATIONINFO = Attributes: 1 - Type: 204 - Value:
ID OPTIMIZE = Attributes: 1 - Type: 11 - Value: False
[/code]

As you can see, it is an auto-incremented field in the DB, but the code properties show it as false...same with Key.

Am I (or the code) missing something?

Thanks,

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top