G
Guest
Hello,
I am trying to adapt the code found under Access Help and “CreateField
Method Example†to my situation. I have created the table and have added
fields. Now I want to see a list of the fields. I am using the following
code from the example, but have changed some lines to comments. When running
this code I receive an error that says, “Run-time error 13, type mismatchâ€
The error occurs on the "For Each fldLoop In tdfNew.Fields" line. What am I
missing here?
Selections of the code are as follows:
Dim dbsNorthwind As DAO.Database
Dim tdfNew As TableDef
Dim prpLoop As Property
Dim fldLoop As Field
Set dbsNorthwind = CurrentDb
' Enumerate Fields collection to show the properties of
' the new Field objects.
For Each fldLoop In tdfNew.Fields
Debug.Print " " & fldLoop.Name
'For Each prpLoop In fldLoop.Properties
' ' Properties that are invalid in the context of
' ' TableDefs will trigger an error if an attempt
' ' is made to read their values.
' On Error Resume Next
' Debug.Print " " & prpLoop.Name & " - " & _
' IIf(prpLoop = "", "[empty]", prpLoop)
' On Error GoTo 0
'Next prpLoop
Next fldLoop
Thank you,
Keith
I am trying to adapt the code found under Access Help and “CreateField
Method Example†to my situation. I have created the table and have added
fields. Now I want to see a list of the fields. I am using the following
code from the example, but have changed some lines to comments. When running
this code I receive an error that says, “Run-time error 13, type mismatchâ€
The error occurs on the "For Each fldLoop In tdfNew.Fields" line. What am I
missing here?
Selections of the code are as follows:
Dim dbsNorthwind As DAO.Database
Dim tdfNew As TableDef
Dim prpLoop As Property
Dim fldLoop As Field
Set dbsNorthwind = CurrentDb
' Enumerate Fields collection to show the properties of
' the new Field objects.
For Each fldLoop In tdfNew.Fields
Debug.Print " " & fldLoop.Name
'For Each prpLoop In fldLoop.Properties
' ' Properties that are invalid in the context of
' ' TableDefs will trigger an error if an attempt
' ' is made to read their values.
' On Error Resume Next
' Debug.Print " " & prpLoop.Name & " - " & _
' IIf(prpLoop = "", "[empty]", prpLoop)
' On Error GoTo 0
'Next prpLoop
Next fldLoop
Thank you,
Keith