Need to store module code in table

B

Ben

Hello,

Im trying to build code that will store all record sources for all objects
in a database into a table. I am able to get the data for linked tables,
queries and reports, but I do not know how to get the 'code' for a module. I
tied modules('module1') but i do not know which subroutine to use.

I am also interested in using this to create a simple report to print out
all the code in a database for verification purposes.

Thanks for any and all help
Ben
 
M

Marshall Barton

Ben said:
Im trying to build code that will store all record sources for all objects
in a database into a table. I am able to get the data for linked tables,
queries and reports, but I do not know how to get the 'code' for a module. I
tied modules('module1') but i do not know which subroutine to use.

I am also interested in using this to create a simple report to print out
all the code in a database for verification purposes.


Here's some basic logic to demonstrate getting the code in
the modules in a database:

Dim db As Database
Dim doc As Document

Set db = CurrentDb()
For Each doc In db.Containers!Modules.Documents
DoCmd.OpenModule doc.Name
With Modules(doc.Name)
rs!memofield = .Lines(1, 100000)
End With
Next

For Each doc In db.Containers!Reports.Documents
DoCmd.OpenForm doc.Name, acDesign
With Forms(doc.Name).Module
rs!memofield = .Lines(1, 100000)
End With
Next
 
B

Ben

Thank you very much Marshall. Exactly what I was looking for. Ill have to
wait till tommorow to try it at work, but thats again!
 
A

Albert D.Kallal

I am also interested in using this to create a simple report to print out
all the code in a database for verification purposes.

You do realize that the ability to print out the table structures, or print
out all the sql query, or printout all of the code is built into
ms-access..right?

You can find this documentation feature by going:

tools->analyze->documenter.

The above will allow you to "document",a nd print out all tales, forms,
code, reports etc....
 

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