Run error 13 Incompatible types

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
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top