MS-Access/VBA - Extracting the active variables (run-time version)

Is it possible to extract a list of all of the variables that appear in the "Locals" window - when in runtime mode?  Ideally, I could use this if an error occurs.
Andy BrownDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
Not that I've seen. I believe it is for debugging only - turn it on at watch as you step through a function, mostly when an error has occurred.
0
Andy BrownDeveloperAuthor Commented:
I think you're right.  I have been using it as you mentioned, but just thought how helpful it would be to capture that information when it's running.
0
Gustav BrockCIOCommented:
You could make them global variables - then they could be retrieved at all times ... until an End.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Andy BrownDeveloperAuthor Commented:
That's true and not a bad idea, but would require a big overhaul.
0
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
The free sample I have posted on my blog:
Access Crash Reporter
will collect screenshots of the application, and open forms (if not in dialog mode), collect various system information (version, OS version....) but it does not collect variables.

It can then email all this information to the email address of your choice. The screenshots gives you a pretty good idea about what is going on, from the users perspective. Whethe or not the program takes screenshots is a simple setting, so you can disable that, if you are not comfortable with that part.
0
BitsqueezerCommented:
Hi,

you could only do that on your own. For example, you could use an error handler with a procedure which accepts parameters as ParamArray (so independent of type and number of parameters) and in this procedure you would read out the ParamArray and save the values for example into an error log or whatever you want to do with them. But as these are only the values you would also need to add the variable names in the ParamArray. That would be OK for a simple datatype as for example Long, but if you use some complicate object with thousands of properties like a Recordset it can not be easily read out.
You would also need to add an error handler into each procedure where you would want to use that and there you would need to forward all used variables (with name and value) as a ParamArray to the above mentioned procedure. Something like:

procErrorHandler Err.Number, Err.Description, "Variable1", Variable1, "MyStringVariable", MyStringVariable  ' the last four would be the ParamArray

Open in new window


And you also would need to change that any time you use a new variable, delete an existing or change a name.

As far as I know there is an existing module on the market which integrates an own VBA error handler as a short assembly binary coded into a VBA string which is able to get a list of variables and output that. It's your decision if you trust such module as of course you cannot see what's in the assembly code and what it really does in the background and if it does not create issues in your application. I saw that in the past here at a user named "developingprogrammer" two or three years ago I think. If you search for him and his entries here I think you'll find some demo database containing it (you can only use it, to integrate it into own projects you need to purchase that, it's not freeware as far as I know).

Cheers,

Christian
0
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Sounds like you are talking about vbWatchdog by Wayne Philips.
https://www.everythingaccess.com/vbwatchdog.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BitsqueezerCommented:
Hi Anders,

yes, you were some seconds faster than me..:-)

You're right, that was the one I talked about.

Cheers,

Christian
0
Andy BrownDeveloperAuthor Commented:
Brilliant - I'll take a look at that.

I already have a pretty decent error handling mechanism in my application that gives me pretty much everything I need (and passes key/tracked variables through when an error occurs).  However, it would be a "nice to have", to make sure I get ALL of the variables that are in play.

Thanks guys.
0
Andy BrownDeveloperAuthor Commented:
Thanks everyone.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.