473,385 Members | 1,506 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,385 software developers and data experts.

Procedure list

I get the urge to do this every several years, and in each new language I
get proficient in. I want to write a program that will generate an indented
list (maybe I'll learn about TreeViews later) of the function call structure
of my VB code. In other languages, like C or Pascal, I was going to scan
the entire program to find the function names, then scan again looking for
anywhere those function names are called, keeping track of which one I'm in
at the time. With the code not all contiguous but in various modules, I
can't do it that way, but it looks like I should be able to grab all the
names from a Procedures collection or something. I've looked into it enough
to think I'm close, then the help text blows past it into areas that don't
seem related. Can anyone offer pointers or code snippets to enumerate all
the Functions and Subs in a db? Do I have to hit the modules separately, or
are they all stored together? Etc, etc.

Thanks,

Armando
Nov 13 '05 #1
6 6555
Armando wrote:
I get the urge to do this every several years, and in each new language I
get proficient in. I want to write a program that will generate an indented
list (maybe I'll learn about TreeViews later) of the function call structure
of my VB code. In other languages, like C or Pascal, I was going to scan
the entire program to find the function names, then scan again looking for
anywhere those function names are called, keeping track of which one I'm in
at the time. With the code not all contiguous but in various modules, I
can't do it that way, but it looks like I should be able to grab all the
names from a Procedures collection or something. I've looked into it enough
to think I'm close, then the help text blows past it into areas that don't
seem related. Can anyone offer pointers or code snippets to enumerate all
the Functions and Subs in a db? Do I have to hit the modules separately, or
are they all stored together? Etc, etc.

Thanks,

Armando

Public Sub ModuleList()
Dim dbs As Database
Dim doc As Document
Set dbs = CurrentDb

With dbs.Containers!Modules
For Each doc In .Documents
AllProcs doc.name
Next
End With
dbs.Close
Set dbs = Nothing
MsgBox "Done"
End Sub

'taken straight out of help example in MS Access. You didn't look in
the right places.
Function AllProcs(strModuleName As String)
Dim mdl As Module
Dim lngCount As Long, lngCountDecl As Long, lngI As Long
Dim strProcName As String, astrProcNames() As String
Dim intI As Integer, strMsg As String
Dim lngR As Long

' Open specified Module object.
DoCmd.OpenModule strModuleName
' Return reference to Module object.
Set mdl = Modules(strModuleName)
' Count lines in module.
lngCount = mdl.CountOfLines
' Count lines in Declaration section in module.

lngCountDecl = mdl.CountOfDeclarationLines
' Determine name of first procedure.
strProcName = mdl.ProcOfLine(lngCountDecl + 1, lngR)
' Initialize counter variable.
intI = 0
' Redimension array.
ReDim Preserve astrProcNames(intI)
' Store name of first procedure in array.
astrProcNames(intI) = strProcName
' Determine procedure name for each line after declarations.
For lngI = lngCountDecl + 1 To lngCount
' Compare procedure name with ProcOfLine property value.

If strProcName <> mdl.ProcOfLine(lngI, lngR) Then
' Increment counter.
intI = intI + 1
strProcName = mdl.ProcOfLine(lngI, lngR)
ReDim Preserve astrProcNames(intI)
' Assign unique procedure names to array.
astrProcNames(intI) = strProcName
End If
Next lngI
strMsg = "Procedures in module '" & strModuleName & "': " _
& vbCrLf & vbCrLf
For intI = 0 To UBound(astrProcNames)
strMsg = strMsg & astrProcNames(intI) & vbCrLf

Next intI
' Dialog box listing all procedures in module.
MsgBox strMsg
End Function

Nov 13 '05 #2
"Salad" <oi*@vinegar.com> wrote in message
news:pv***************@newsread1.news.pas.earthlin k.net...
Armando wrote:
Can anyone offer pointers or code snippets to enumerate all
the Functions and Subs in a db?
'taken straight out of help example in MS Access. You didn't look in
the right places.
(code deleted)


I guess I didn't. I thought I hit every related topic there was. Thanks
for the info, I'll see what I can do with it.

Armando

Nov 13 '05 #3
Salad,

Now that I look this code over, I think I did come across it in my
wandering. It does indeed do what my question asked, but it turns out I
didn't say it right. I haven't figured out how to get into the Form
modules, where a lot of my code lives.

It's probably just a few tweaks from this code, but I'm still green on the
structure and accessing of the Collections. I need to get another good book
on A2000, I had to leave all my references behind.

Armando
Nov 13 '05 #4
Armando wrote:
Salad,

Now that I look this code over, I think I did come across it in my
wandering. It does indeed do what my question asked, but it turns out I
didn't say it right. I haven't figured out how to get into the Form
modules, where a lot of my code lives.

It's probably just a few tweaks from this code, but I'm still green on the
structure and accessing of the Collections. I need to get another good book
on A2000, I had to leave all my references behind.

Armando

Every now and then you have to do some snipping and tucking and
modifying of what you were provided to get the answer.

I have an exitfor at the bottom you can remove if you want to cycle
through all of the forms.

I think with this code you can adjust it to go through Reports.
Unfortunately, Reports does not have an acHidden property in A97, so you
may get some flashing unless you set the echo off.

Sub FormModules()
Dim dbs As Database
Dim doc As Document
Dim frm As Form

Dim lngCount As Long
Dim lngCountDecl As Long
Dim lngI As Long
Dim strProcName As String
Dim astrProcNames() As String
Dim intI As Integer
Dim strMsg As String
Dim lngR As Long

Set dbs = CurrentDb

With dbs.Containers!Forms
For Each doc In .Documents
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
Set frm = Forms(doc.Name)
' Set form properties.
With frm
lngCount = frm.Module.CountOfLines
lngCountDecl = frm.Module.CountOfDeclarationLines
' Determine name of first procedure.
strProcName = frm.Module.ProcOfLine(lngCountDecl + 1, lngR)
' Initialize counter variable.
intI = 0
' Redimension array.
ReDim Preserve astrProcNames(intI)
' Store name of first procedure in array.
astrProcNames(intI) = strProcName
' Determine procedure name for each line after
declarations.
For lngI = lngCountDecl + 1 To lngCount
' Compare procedure name with ProcOfLine property value.

If strProcName <> frm.Module.ProcOfLine(lngI, lngR)
Then
' Increment counter.
intI = intI + 1
strProcName = frm.Module.ProcOfLine(lngI, lngR)
ReDim Preserve astrProcNames(intI)
' Assign unique procedure names to array.
astrProcNames(intI) = strProcName
End If
Next lngI
strMsg = "Procedures in Form " & doc.Name & " Module: " _
& vbCrLf & vbCrLf
For intI = 0 To UBound(astrProcNames)
strMsg = strMsg & astrProcNames(intI) & vbCrLf

Next intI
' Dialog box listing all procedures in module.
MsgBox strMsg
End With
Set frm = Nothing
DoCmd.Close acForm, doc.Name

'remove this is you want to cycle through all of the forms
Exit For
Next doc
End With
Set dbs = Nothing
MsgBox "Done"
End Sub
Nov 13 '05 #5
I have been playing with the code you cited last, to help me learn about
Collections, Containers, and how they all interrelate. Drawing a map as I
go. A map that I HAD ONCE!

I went shopping for a reference today, but walked away with sticker shock,
until I can spend enough time making sure I get the right one. Even the
most advanced ones look like they're holding your hand, showing how to
design a Table or Form, and chapters on !! how to use the design wizards !!

Gracias encore...
Nov 13 '05 #6
Armando wrote:
I have been playing with the code you cited last, to help me learn about
Collections, Containers, and how they all interrelate. Drawing a map as I
go. A map that I HAD ONCE!

I went shopping for a reference today, but walked away with sticker shock,
until I can spend enough time making sure I get the right one. Even the
most advanced ones look like they're holding your hand, showing how to
design a Table or Form, and chapters on !! how to use the design wizards !!

Gracias encore...

A popular book is the Access (version) Developers Guide. If you know
how to code, that would be a good start. It's worth the money if you
are going to code in Access.

I find the best reference available is http://groups.google.com.

About the worst reference for Access in on-line help if you have a
version above A97...MS seemed to go out of their way to may their help
system useless. Some call it MS Helpless.
Nov 13 '05 #7

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

Similar topics

7
by: Tod Thames | last post by:
I am running SQL Server 7.0 and using a web interface. I would like for a user to be able to input multiple values into a single field with some sort of delimiter (such as a comma). I want to...
3
by: aaj | last post by:
SQL SERVER 2000 Hi all This is my first attempt at writing a stored procedure. I have managed to get it working but its unlikely to be the best way of handling the problem. While writing it I...
0
by: barbara | last post by:
I am using this procedure from net for getting the restore script. It lists the latest full backup file name and logs after that point. Is there any way to modify this script to take either date...
1
by: Raquel | last post by:
Have a question on the Stored procedure method code generated by DB2 development center for Java stored procedures. Suppose I have a requirement to return the resultset consisting of FIRSTNME,...
2
by: Brian Tkatch | last post by:
DB2/SUN 8.1.6 Using the client and CREATEing a PROCEDURE with a one-character name and DECLAREing a CURSOR using WITH RETURN TO CLIENT, does not result in a RESULT SET being shown. CREATE...
1
by: phil | last post by:
I have been developing some queries which will list the dependencies of Stored Procedures (this is with DB2/UDB v8). In doing so, I have noticed that dependencies are ignored if they occur in an...
2
by: karups | last post by:
Hi, I've got listbox in my .aspx page where the users can make multiple selection. So, Users can select any number of items in listbox, I have to take value from items and pass it to stored...
9
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio...
1
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and...
7
by: Karl | last post by:
Is there a way to run a procedure in a different open database?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.