Type mismatch problem

Can anyone tell me why I get a Type Mismatch error 13 in the highlighted line of code?  I think it worked in Access 2003 but that may be misleading.

Thanks in advance.
Capture.JPG
Clive BeatonAccess DeveloperAsked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
That's odd. You can use code like you've got (i.e. nested For Each loops) to do this. This code runs find on my machine:

Dim doc As DAO.Document
Dim con As DAO.Container
Dim dbs As DAO.Database
Dim prop As DAO.Property

Set dbs = CurrentDb
Set con = dbs.Containers("Forms")

For Each doc In con.Documents
  For Each prop In doc.Properties
    Debug.Print prop.Name
  Next
Next

It's basically the same as your's without the Recordset stuff, although I have declared my variables differently. You might try disambigulating your variables as I've done (i.e. declare them as DAO.Property instead of Property).

If that doesn't fix it, you might try Compacting the databases, and also Compiling them.

0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
My only guess is that ... you need to have a  Set Doc = <something> statement in that loop

As a side note, please post code instead of code in a jpg, so that it can be copy and pasted for testing.

mx
0
 
Pratima PharandeCommented:
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
How is that link related to this problem ?

mx
0
 
Clive BeatonAccess DeveloperAuthor Commented:
Thanks.  Worked fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.