473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to get text from ms-access module in remote db?

I need to scan a couple of hundred databases in several directories to
locate all code that uses a particular function, but cannot figure out
how to read the Form or Module text itself.

I am able to locate, then connect to the databases, and have figured
out how to get the Form and Module names easy enough using the
documents collection of each of the Form and Module containers, but
how do I actually read the code to find out which contain the function
code I am searching?

Is there any more direct way to read it rather than using
Application.SaveAsText?
----------------------------
set db = OpenDatabase([Database path and name])
for i = 0 to db.Containers("Modules").Documents.Count
oDoc = db.Containers("Modules").Documents(i)
sName = oDoc.Name '- Wonks so far ...
sText = oDoc.???? How do I read the actual text (code) in each
module or form?
---------------------------
Thanks in Advance - jfro
Nov 13 '05 #1
3 5646
The Containers Collection and Documents class for the Modules objects
contains no interface to the VBA code. If you want to access the module
code programmatically, then you'll need to use the DoCmd.OpenModule method
from the Access Application object used to open the remote database, so you
don't need to use the OpenDatabase method in your code below, either.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
"JimF" <jf****@marinusdigital.com> wrote in message
news:56**************************@posting.google.c om...
I need to scan a couple of hundred databases in several directories to
locate all code that uses a particular function, but cannot figure out
how to read the Form or Module text itself.

I am able to locate, then connect to the databases, and have figured
out how to get the Form and Module names easy enough using the
documents collection of each of the Form and Module containers, but
how do I actually read the code to find out which contain the function
code I am searching?

Is there any more direct way to read it rather than using
Application.SaveAsText?
----------------------------
set db = OpenDatabase([Database path and name])
for i = 0 to db.Containers("Modules").Documents.Count
oDoc = db.Containers("Modules").Documents(i)
sName = oDoc.Name '- Wonks so far ...
sText = oDoc.???? How do I read the actual text (code) in each
module or form?
---------------------------
Thanks in Advance - jfro

Nov 13 '05 #2

Quick bit of code so you'll need to test etc. but it should get you started

Sub IterateModules(DBName As String)
Dim oApp As Access.Application
Dim db As DAO.Database
Dim oDoc As DAO.Document
Dim oMod As Access.Module
Dim sText As String

Set oApp = New Access.Application

oApp.OpenCurrentDatabase DBName

Set db = oApp.CurrentDb

For Each oDoc In db.Containers("Modules").Documents
oApp.DoCmd.OpenModule oDoc.Name

Set oMod = oApp.Modules(oDoc.Name)
With oMod
sText = .Lines(1, .CountOfLines)
End With

' do stuff with stext
Next

Set oDoc = Nothing
Set oMod = Nothing
Set db = Nothing
oApp.Quit acQuitSaveNone
Set oApp = Nothing

End Sub
--
Terry Kreft
MVP Microsoft Access
"JimF" <jf****@marinusdigital.com> wrote in message
news:56**************************@posting.google.c om...
I need to scan a couple of hundred databases in several directories to
locate all code that uses a particular function, but cannot figure out
how to read the Form or Module text itself.

I am able to locate, then connect to the databases, and have figured
out how to get the Form and Module names easy enough using the
documents collection of each of the Form and Module containers, but
how do I actually read the code to find out which contain the function
code I am searching?

Is there any more direct way to read it rather than using
Application.SaveAsText?
----------------------------
set db = OpenDatabase([Database path and name])
for i = 0 to db.Containers("Modules").Documents.Count
oDoc = db.Containers("Modules").Documents(i)
sName = oDoc.Name '- Wonks so far ...
sText = oDoc.???? How do I read the actual text (code) in each
module or form?
---------------------------
Thanks in Advance - jfro

Nov 13 '05 #3
> Quick bit of code so you'll need to test etc. but it should get you started

Terry, Gunny ... exactly what I needed. Thanks! Jim
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: newtda | last post by:
What I am trying to do is when the user clicks on the date th month/date/year appears in the text box like this: 1/15/2004. Ho would I do this. This is not home work, but it is for a client o...
2
by: zwylle | last post by:
Hi all, to avoid a nervous breakdown I finally decided to seek help :D I have a table defined with plain color background and in some cells I show pictures to frame my site. The problem I...
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
5
by: Steve S | last post by:
Heres what I want to do...User types into a texbox, clicks a button, the button saves that text to a file. The problem is that when I click the submit button, any changes made to the textbox are...
3
by: sb Luis | last post by:
I Use the following code to read from MS Word, but I couldent read Formated Text (RTF). How Can I read formated text from MS Word Doc without using clipboard. thanks. Word.ApplicationClass...
10
by: Cerebral Believer | last post by:
Hi all, I am keen to allow people who view my site to be able to resize the text in their browsers (especially for people who need to read larger text). With my old web-page I specified the...
5
by: Carstonio | last post by:
I use ASP to display links to Word documents on an intranet. Is there a way in ASP to do text searches on the documents' contents? I want the results to have the link to the Word document plus two...
5
by: visu | last post by:
Hi this is a question asked in this group two years back.. No answer for this question till date. now i am in the same situation of the questioner.. to find a solution for this problem. Can any...
4
by: darith | last post by:
Hi all, I want to know code in vb.net to get number of selected text in MS Word. how can we write? Please help me. I need it urgent. in textbox we just write textbox.selectedtext so we can get...
0
by: darith | last post by:
Hello all, I want vb.net code to get selected text from Ms word. Could you kindly help me? For example, Imports Microsoft.Office.Core Imports Microsoft.Office.Interop Dim wapp As...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.