By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Getting text of Modules in non CurrentDB

P: n/a

I'm curious about getting to the text of procedures in a database other
than the current database without a new instance of Access. Note I don't
want to execute or call anything, I just want to get to the text of each
module.
No Networks involved, just multiple drives on one local machine.

<ramble>
Win98, Access 8

I don't have the self discipline to keep track of all the incidental bits
of code I write to do one off, small (or large) tasks. Sometimes I need to
sledgehammer my way through all my MDBs to find a half remembered bit of
code.

I can quite happily do what I want by ...

<dim stuff, oApp as Object ...>
DBName$ = ThatDB.mdb
Set oApp = New Access.Application
oApp.OpenCurrentDatabase DBName
Set db = oApp.CurrentDb

Then I can wander through the oDocs in db.Containers("Modules").Documents
and open the modules oApp.DoCmd.OpenModule oDoc.Name , grab all the text
sText = .Lines(1, .countOfLines) , slice things out with all those handy
tools like ProcStartLine, ProcBodyLine and such. Maybe shove it all in a
table where I can search and sort, get distracted, forget what I was after
and do something else instead.
</ramble(This Tag often ignored)

I'm puzzled about why I can't get to the other modules just by setting a
Reference to the other database.

Given these Objects.

1. The CurrentDB
Database - ThisDB.mdb
Project: - ThisDB
Module: - mThisMod
Procedure - sThisSub

I'm working in sThisSub

2. The OtherDB
Database - ThatDB.mdb
Project: - ThatDB
Module: - mThatMod
Procedure - sThatSub

While editing sThisSub, I can add a Reference to ThatDB and in the Object
Browser zip through to mThatMod, double click it, grab code or even edit
its code and save it. All very handy, thank you Access.

Now the question. When I want to talk to the text of a module in another
database:

Can I open the module and explore the entrails by setting a Reference to
the other project, rather than getting to it from another instance of
Access.Application?

If I can, should I? My gut feeling is there would be less overhead and
things would be more stable.

If I can, HOW? That was a frustrated shout. I've tried all the logical (to
me) ways of talking to the other project, IntelliSense shows me everything
I want, but my last remaining brain cell just won't tell me the syntax.

Can anyone give me a yes, no or maybe? I seem to remember Terry Kreft
talking about this many years ago.

Cheers,
Alan
Oct 23 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.