[AccessD] Looping through code modules

rosalyn.clarke at barclays.com rosalyn.clarke at barclays.com
Tue Apr 8 03:27:04 CDT 2008


Hi Mark

I'm looping through and creating a list of code modules (module type, form &
report modules) and writing them to a recordset so they can be selected /
deselected for processing. Processing involves searching for error handling,
inserting it if there is none, or replacing it if there is any - with a call
to a central error handler. I'd like in future to do it so it shows you the
changes before committing them, which will involve saving the code out
somewhere I guess.

It's designed to run as an mda & work on the current database, so the target
database will always be open. I'm using the Containers collection at the
moment, and it works ok, it just seems a little clunky.

Thanks for your answer. Coming at this very much from an Access direction I
didn't consider the VBComponents collection.

Cheers

Roz

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: 07 April 2008 22:07
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Looping through code modules


Roz,

I have just done some work on this.  When you say "getting the code
modules"...do you want to save them as text files, store the text in a memo
field, just search for keywords, or something else?

I have found 3 approaches...each has its pros and cons.  My project involved
searching an entire list of MDBs from a single mdb.

In no particular order:

1A.  loop through DB.Containers
2A.  set new application  and loop through
rapp.VBE.ActiveVBProject.VBComponents
3A.  set new reference ref = References.AddFromFile("C:\Temp\MyNew.mdb") and
loop through VBE.VBProjects(ref.Name).VBComponents

I was trying to search the code for a specific string...here are some of the
issues I had with the 3 approaches...although I'm not done with my testing.

1A.  This approach seemed useful for exporting or storing code in tables.
2A.  This one was easy to search the code...but it opened each database to do
it.
3A.  This one did not open each MDB...but it had an issue with referencing an
mdb of an earlier version.

Please let me know if you have specific questions about any of it.

Thanks,

Mark A. Matte






----------------------------------------
> Date: Mon, 7 Apr 2008 15:32:47 +0100
> From: rosalyn.clarke at barclays.com
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Looping through code modules
> 
> Hi all
> 
> Does anyone know if there is a quicker / neater way of getting all the 
> (open or closed) code modules in a database than going through the 
> modules, forms and reports collections in turn?
> 
> TIA
> 
> Roz
> 
> "DSMP Mission - Building the future of Barclays computing 
> infrastructure.  4K customers won in 2007, 10k+ to delight in 2008."
> 
> 
> 
> This e-mail and any attachments are confidential and intended solely for
the addressee and may also be privileged or exempt from disclosure under
applicable law. If you are not the addressee, or have received this e-mail in
error, please notify the sender immediately, delete it from your system and
do not copy, disclose or otherwise act upon any part of this e-mail or its
attachments.
> 
> Internet communications are not guaranteed to be secure or virus-free.
> The Barclays Group does not accept responsibility for any loss arising from
unauthorised access to, or interference with, any Internet communications by
any third party, or from the transmission of any viruses. Replies to this
e-mail may be monitored by the Barclays Group for operational or business
reasons.
> 
> Any opinion or other information in this e-mail or its attachments that
does not relate to the business of the Barclays Group is personal to the
sender and is not given or endorsed by the Barclays Group.
> 
> Barclays Bank PLC.Registered in England and Wales (registered no. 1026167).
> Registered Office: 1 Churchill Place, London, E14 5HP, United Kingdom.
> 
> Barclays Bank PLC is authorised and regulated by the Financial Services
Authority.
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________
Going green? See the top 12 foods to eat organic.
http://green.msn.com/galleries/photos/photos.aspx?gid=164&ocid=T003MSN51N1653
A
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments.

Internet communications are not guaranteed to be secure or virus-free.
The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons.

Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group.

Barclays Bank PLC.Registered in England and Wales (registered no. 1026167).
Registered Office: 1 Churchill Place, London, E14 5HP, United Kingdom.

Barclays Bank PLC is authorised and regulated by the Financial Services Authority.




More information about the AccessD mailing list