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.
Clive BeatonAccess DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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.

Pratima PharandeCommented:
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
How is that link related to this problem ?

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

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Clive BeatonAccess DeveloperAuthor Commented:
Thanks.  Worked fine.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.