473,413 Members | 2,056 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,413 software developers and data experts.

Determining current procedure and arguments

Lyn
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?

To assist in debugging, I would like to be able to trace the procedures as
they are executed. Then, when it crashes with Access's usual unhelpful
error messages, at least I will be able to determine in which procedure it
happened.

What I had in mind was something like this, inserted as the first statement
in every procedure during development:

If DebugMode Then
<extract required information about procedure>
Debug.Print <procedurename, arguments>
End If

Of course one solution would be to tailor the above by manually inserting
the procedure and argument information in each case, but with a large
project this would be quite tedious. I would rather have some standard code
that I can just drop in to each procedure as I go.

Do procedures have properties (as do forms, controls, etc)? Is there a way
to determine the current procedure (similar to the "Me" for the current
form)? I have found nothing in the Help manual or in various other
resources, so I suspect that there is nothing like this. But the experts
very likely have some sneaky way to accomplish this!

TIA for any help.

--
Cheers,
Lyn.
Nov 13 '05 #1
5 2973
Look at MZTools, this is an Add-In for VB and VBA one of the things it
allows you to do is enter procedure comments, which you could edit to the
code you require, it uses tags in the comment you create in order to insert
the current module and procedure name.

You can pick it up from www.mztools.com

--
Terry Kreft
MVP Microsoft Access
"Lyn" <lh******@ihug.com.au> wrote in message
news:cs**********@lust.ihug.co.nz...
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?

To assist in debugging, I would like to be able to trace the procedures as
they are executed. Then, when it crashes with Access's usual unhelpful
error messages, at least I will be able to determine in which procedure it
happened.

What I had in mind was something like this, inserted as the first statement in every procedure during development:

If DebugMode Then
<extract required information about procedure>
Debug.Print <procedurename, arguments>
End If

Of course one solution would be to tailor the above by manually inserting
the procedure and argument information in each case, but with a large
project this would be quite tedious. I would rather have some standard code that I can just drop in to each procedure as I go.

Do procedures have properties (as do forms, controls, etc)? Is there a way to determine the current procedure (similar to the "Me" for the current
form)? I have found nothing in the Help manual or in various other
resources, so I suspect that there is nothing like this. But the experts
very likely have some sneaky way to accomplish this!

TIA for any help.

--
Cheers,
Lyn.

Nov 13 '05 #2
On Wed, 12 Jan 2005 16:57:42 +1100, in comp.databases.ms-access you
wrote:
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?
Hi
Alas no unless it has been a very well kept secret for many years.

(snip)
Of course one solution would be to tailor the above by manually inserting
the procedure and argument information in each case, but with a large
project this would be quite tedious.
There are tools which can do the inserts for you, eg from FMS, or take
a look at codewriter2 at http://www.datastrat.com/DataStrat2.html--
Cheers,
Lyn.

David

Nov 13 '05 #3
Lyn
Thanks David and Terry for your replies, which confirmed my fears.

I will check out the references you have provided to see if I can find a
solution in one of them.

--
Cheers,
Lyn.

"David Schofield" <d.***************@blueyonder.co.uk> wrote in message
news:41e5848e.61447837@localhost...
On Wed, 12 Jan 2005 16:57:42 +1100, in comp.databases.ms-access you
wrote:
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?


Hi
Alas no unless it has been a very well kept secret for many years.

(snip)

Of course one solution would be to tailor the above by manually inserting
the procedure and argument information in each case, but with a large
project this would be quite tedious.


There are tools which can do the inserts for you, eg from FMS, or take
a look at codewriter2 at http://www.datastrat.com/DataStrat2.html
--
Cheers,
Lyn.

David

Nov 13 '05 #4
Lyn
I have downloaded MZTools and have been able to adapt one of its features to
debug.print a trace of all procedures executed. I would have liked to have
included in the trace a list of the arguments passed, but MZTools does not
seem to have that capability (but I am still checking).

Thanks again for the help.

--
Cheers,
Lyn.

"Lyn" <lh******@ihug.com.au> wrote in message
news:cs**********@lust.ihug.co.nz...
Thanks David and Terry for your replies, which confirmed my fears.

I will check out the references you have provided to see if I can find a
solution in one of them.

--
Cheers,
Lyn.

"David Schofield" <d.***************@blueyonder.co.uk> wrote in message
news:41e5848e.61447837@localhost...
On Wed, 12 Jan 2005 16:57:42 +1100, in comp.databases.ms-access you
wrote:
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?


Hi
Alas no unless it has been a very well kept secret for many years.

(snip)

Of course one solution would be to tailor the above by manually inserting
the procedure and argument information in each case, but with a large
project this would be quite tedious.


There are tools which can do the inserts for you, eg from FMS, or take
a look at codewriter2 at http://www.datastrat.com/DataStrat2.html
--
Cheers,
Lyn.

David


Nov 13 '05 #5
On 12 Jan 2005 14:15:04 -0600, d.***************@blueyonder.co.uk
(David Schofield) wrote:
On Wed, 12 Jan 2005 16:57:42 +1100, in comp.databases.ms-access I
wrote:
Is there any way of determining in VBA the name and arguments of the
currently executed procedure?


Hi
Alas no unless it has been a very well kept secret for many years.

(snip)

This reply was too categorical. Hardcore enthusiast may care to look
at (this is for VB classic)
Getting the name of the current and calling function at runtime
http://www.constantthought.com/yabbs...y;threadid=240

- David

Nov 13 '05 #6

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

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
8
by: Mark English | last post by:
I'd like to write a Tkinter app which, given a class, pops up a window(s) with fields for each "attribute" of that class. The user could enter values for the attributes and on closing the window...
2
by: William Payne | last post by:
Hello, I am making a very simple and crude Makefile generator, that currently supports three different options: --project-name=<name_of_project>...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
3
by: c_shah | last post by:
VB 2005 and windows form application I am having difficulty putting my question into words but.. Is there a way to determine whether my win form application has focus or it is active or being...
1
by: C#_Beginner | last post by:
I was wondering if someone can help me out. I'm getting the following error: Message: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_RIGHTS2'...
8
by: =?Utf-8?B?R2VvcmdlQXRraW5z?= | last post by:
Greetings! I wrote a small Exe that simply runs Shell to load PowerPoint and launch a particular file, depending on the day of the week. However, it was set up for office 2003 (I naively hardcoded...
7
by: Brad Pears | last post by:
I am developing a simple error message class and would like the be able to generate as part of the message the curent class/module/form and function or sub that the error was generated in without...
1
by: Kevin Wilcox | last post by:
In response to queries about getting the name of the current procedure for error handling etc, respondents have recommended using e.g. MZ Tools. I've downloaded this, but have a quick query before...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.