Search modules programmatically

M

Morten Snedker

I've made myself some nice code that searches the datasource of all
forms, reports and their controls for a given expression.

However, I wish to search modules as well for a given expression.
Is this possible - and how?


Regards /Snedker
 
M

Marshall Barton

Morten said:
I've made myself some nice code that searches the datasource of all
forms, reports and their controls for a given expression.

However, I wish to search modules as well for a given expression.
Is this possible - and how?


Sure you can. There's a bunch of methods of the module
object to do funky things like this.

You can get to each standard or class Module object with
this kind of reference:

For Each doc In dbCur.Containers("Modules").Documents
DoCmd.OpenModule doc.Name

and go from there.

Form and Report modules are available when you open the
form/report in design view:

For Each doc In dbCur.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
With Forms(doc.Name)
If .HasModule Then

Check Help to see the methods of the Module object.
 

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