Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-17-2019, 02:15 AM   #1
NauticalGent
Pristine Curmudgeon
Gold Supporter
 
NauticalGent's Avatar
 
Join Date: Apr 2015
Location: Naples, Italy (EXPAT from Virginia)
Posts: 1,849
Thanks: 404
Thanked 265 Times in 231 Posts
NauticalGent has a spectacular aura about NauticalGent has a spectacular aura about
Call Stack, who knew??

All the time I have wasted tracing through code when the ultimate short-cut was right there in front of me...

__________________
- Ciao, John
NauticalGent is online now   Reply With Quote
Old 07-17-2019, 05:18 AM   #2
plog
AWF VIP
 
Join Date: May 2011
Posts: 9,306
Thanks: 10
Thanked 2,259 Times in 2,211 Posts
plog is a jewel in the rough plog is a jewel in the rough plog is a jewel in the rough
Re: Call Stack, who knew??

How about a link or further explanation for those who follow and are in a similar situation?
plog is offline   Reply With Quote
Old 07-17-2019, 05:25 AM   #3
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,005
Thanks: 78
Thanked 1,986 Times in 1,934 Posts
jdraw is just really nice jdraw is just really nice jdraw is just really nice jdraw is just really nice jdraw is just really nice
Re: Call Stack, who knew??

Lots of info if you google ms access vba callstack

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jdraw is offline   Reply With Quote
Old 07-17-2019, 07:18 AM   #4
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Call Stack, who knew??

Hi
I've never used the call stack so would also be interested in knowing more.

I do know that UA member JonSmith has done a lot of work using this feature and has on several occasions written lengthy posts proclaiming its virtues. May be worth making contact with him
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 07-17-2019, 07:37 AM   #5
theDBguy
I’m here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 3,563
Thanks: 38
Thanked 869 Times in 852 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Call Stack, who knew??

Here's one thread at UA discussing the subject. Cheers!
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 07-17-2019, 08:34 AM   #6
NauticalGent
Pristine Curmudgeon
Gold Supporter
 
NauticalGent's Avatar
 
Join Date: Apr 2015
Location: Naples, Italy (EXPAT from Virginia)
Posts: 1,849
Thanks: 404
Thanked 265 Times in 231 Posts
NauticalGent has a spectacular aura about NauticalGent has a spectacular aura about
Re: Call Stack, who knew??

Apologies for the delay, for some reason my computer at work does not like AWF. Frustrating...

In a nutshell, it makes debugging much, much easier - especially if your code calls Subs and Functions that are not in the current class module you are using.

When I first started using VBA, the vast majority of my code was confined to the form or report I was working on at the time. But as my skills improved and learned how to take advantage of my own UDF’s (thanks to the members of this Forum) it made debugging a bit of a challenge.

Using the Call Stack, I am able to trace back through the code via the Call Stack window. It places the current Sub I am in on the top. By clicking the other Subs in the window, it takes me to the point in the previous Subs where the other Subs were called. A real stream-lined process. Had I known about this feature before, it would have saved me hours of debugging.
__________________
- Ciao, John
NauticalGent is online now   Reply With Quote
Old 07-17-2019, 08:50 AM   #7
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Call Stack, who knew??

Thanks for posting the link DBG. That was the thread I was thinking of.
Despite JonSmith's very detailed code, I have to admit that I never got around to following it up as my own error handling routines have always been more than good enough for both my needs and my clients.

NG: Any chance of a simple example db that demonstrates its value?

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 07-17-2019, 08:53 AM   #8
theDBguy
I’m here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 3,563
Thanks: 38
Thanked 869 Times in 852 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Call Stack, who knew??

Quote:
Originally Posted by isladogs View Post
Thanks for posting the link DBG. That was the thread I was thinking of.
Despite JonSmith's very detailed code, I have to admit that I never got around to following it up as my own error handling routines have always been more than good enough for both my needs and my clients.

NG: Any chance of a simple example db that demonstrates its value?
Hi Colin. Based on NG's description from his last post, I get the impression he's merely talking about hitting Ctrl+L while in debug mode.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 07-17-2019, 11:17 AM   #9
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,142
Thanks: 490
Thanked 899 Times in 852 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Call Stack, who knew??

Quote:
Originally Posted by isladogs View Post
my own error handling routines have always been more than good enough for both my needs and my clients.
I never used to worry too much about putting error checking in my functions. However I had the job of building a a runtime application which ran over Citrix, and it crashed, and crashed, and crashed, and I had to go through it all and put error checking code in it! It took forever, and it was the most thankless task I've ever done!

Now, I have a function stub which already has the error checking code in it. I just paste the function stub into my module. Quick simple easy. I know that if I ever get asked to Change the application to a run-time application then I'm ahead of the game!
__________________
Code:
                 |||||
               @(~Ô^Ô~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 07-17-2019, 11:34 AM   #10
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Call Stack, who knew??

I introduced comprehensive error handling in every routine in my very large schools databases (FE approx 150MB). I did so because I couldn't rely on my clients to pass on detailed & accurate error information and so I couldn't fix issues unless I could replicate them

My error logging routine records all the details of each error - error number/description, exact location where it occurs, who was affected, workstation info, screen resolution, Access version & bitness, OS & bitness, app version etc ...
All of that info is then sent 'silently' by email to me (by agreement with the clients) without the user needing to do anything

The process took a very long time to setup (and I often felt like giving up!) & for the first few weeks after implementation I got a lot of automated emails. However there were relatively few errors involved (repeatedly) and allowed me to fix the bugs quickly
After a couple of months almost all the errors were fixed & I haven't received an error logging email for well over a year. I call that success!

Since then I now build in this code as I develop many of my new apps
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 07-17-2019, 11:59 AM   #11
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,142
Thanks: 490
Thanked 899 Times in 852 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Call Stack, who knew??

Quote:
Originally Posted by isladogs View Post
I haven't received an error logging email for well over a year. I call that success!

That's Impressive!
I think that's partly a problem with MS Access, not a problem actually, but the fact that is so good, and once you've got it right it rarely causes any problems...

The only problem I can recall having which I never solved, in the sense that I never found out what caused it, was having a corrupt record in a table. The customer reported the problem, and I eventually located the corrupted record, then removed it, which to my vague recollection wasn't an easy process to do, removing a corrupt record, or it might have been the finding of it that record... I know it wasn't straightforward. The only thing I could think of that caused the corruption was somebody switching the PC off with MS Access running. I explain my suspicions about the PC being turned off and I've never had another issue with it. Now where's that big piece of wood?

So I think what I'm saying is I've never gone to any great trouble with error checking, just having the ability for each function to report its own name, and the module, or form it's within. I don't take it as far as you obviously have done! Mind you it sounds like the right thing to do especially if you've got a runtime app!
__________________
Code:
                 |||||
               @(~Ô^Ô~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 07-17-2019, 12:44 PM   #12
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Call Stack, who knew??

The last error logging email I received was from someone who had downloaded the DEMO version of an app from my website. That surprised me. I emailed back but got no reply

Anyway the point I was really making was that I haven't seen any benefit in using call stack as I have my own system. But I'd be happy to be persuaded of its merits. As previously mentioned, Jon Smith at UA had some impressive code based on this.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 07-17-2019, 07:55 PM   #13
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,073
Thanks: 81
Thanked 1,597 Times in 1,481 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Call Stack, who knew??

After doing a bit of research, I verified that you can use CTRL/L to display the call frame list on the stack. Which is no "duh" because that was mentioned in this thread. I also noted that there is general agreement in many external articles that without playing a "roll your own DLL" type of game, there is no programmatic way to actually see what is on the stack. I.e. the Access GUI can show you but you can't easily do a VBA-based examination. This is because among other things, the stack usage is not constant and you cannot see the hardware registers - including the user-mode stack pointer.

From one call to the next, the number of items pushed onto the stack is dependent on the local declarations in the subroutine. The amount of space available to the stack is fairly large, but it is hard to say exactly how much stack space you do have. Fortunately, unless you are writing some pretty ugly recursive code, you are unlikely to get a "stack overlaps heap" message - which is quite fatal if you get it.

In the worst code I ever wrote, I think the deepest I've ever seen the stack using the menu to "show call stack" was about a half-dozen layers deep counting the starting Event routine at the bottom of the stack and having several shared formatting routines and computational assistance routines in the stack frame list.

The ability to click on a particular frame so you can see it is a really great debugging tool. And it should be noted that if you do that (i.e. switch code windows to the point where a call occurred), that routine's locally-declared variables and any public variables from a general module still show you their values if you hover the mouse over them - even though the executing code is not in that context at the moment.

I have written some recursive code and I can report that using the "Show Call Frames" option to visit each frame lets you see the correct values for that frame even though the call is recursive and another instantiation of it is elsewhere in the same call frame list.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-19-2019, 07:17 AM   #14
NauticalGent
Pristine Curmudgeon
Gold Supporter
 
NauticalGent's Avatar
 
Join Date: Apr 2015
Location: Naples, Italy (EXPAT from Virginia)
Posts: 1,849
Thanks: 404
Thanked 265 Times in 231 Posts
NauticalGent has a spectacular aura about NauticalGent has a spectacular aura about
Re: Call Stack, who knew??

Quote:
Originally Posted by theDBguy View Post
Hi Colin. Based on NG's description from his last post, I get the impression he's merely talking about hitting Ctrl+L while in debug mode.
Exactly. Really cuts down on my Debug time becuase it lets me “walk backwards” while I am trouble-shooting”. My coding skills are not what the should be so what most of you get done right the first time takes a few attempts for me! Getting better though, if I do say so myself...

Quote:
The ability to click on a particular frame so you can see it is a really great debugging tool. And it should be noted that if you do that (i.e. switch code windows to the point where a call occurred), that routine's locally-declared variables and any public variables from a general module still show you their values if you hover the mouse over them - even though the executing code is not in that context at the moment.
Doc nails it. What I had to do with a #2 pencil and a notepad can now be done on the fly. I can even make my changes and re-run the code from that point - a real time saver.

Funny thing is, it has always been there an two of the books I have bought talk extensively on how to use it but it was too “busy” to take the time to read and understand it. Life is tough, tougher if you’re stupid...

__________________
- Ciao, John
NauticalGent is online now   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Once knew Access well krazykaigh Introduce Yourself 1 04-10-2012 02:35 PM
Error Handling - Outputting Call Stack ions General 6 05-28-2011 06:18 PM
What would you do, if you knew? ShaneMan The Watercooler 19 10-31-2008 09:38 PM
I knew this going to be difficult! lightray Reports 10 11-01-2006 03:18 PM
knew it... mission2java_78 General 2 02-05-2004 05:59 AM




All times are GMT -8. The time now is 01:03 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World