Run error 13 Incompatible types

  • Thread starter Thread starter Fia
  • Start date Start date
F

Fia

Hi
When I use the code below

Sub FieldOutput( )
Dim prpLoop As Property
Dim db as Database
Dim fldTemp As Field
set db= OpenDatabase(CurrentDb.Name)
Set fldTemp= db.TableDefs(0).Fields(0)

For Each prpLoop In fldTemp.Properties
Debug.Print " " & prpLoop.Name & " = " & _
prpLoop.Value
Next prpLoop

End Sub
I get the run error Incompatible types at row "For Each prpLoop In
fldTemp.Properties" and I don't know why.

Can anyone help, please

Fia
 
Unfortunately, there's more than one library that has a Property object.
You need to disambiguate so you get the right one.

The code is using DAO objects, so make your declarations like this:
Dim prpLoop As DAO.Property
Dim db As DAO.Database
Dim fldTemp As DAO.Field
and so on.
 
Back
Top