• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

MACROS CAN ONLY BE CALLED 19 TIMES (1 Viewer)

zainizizah

New member
Local time
Tomorrow, 03:44
Joined
Jul 5, 2020
Messages
4
MACRO CAN ONLY BE CALLED 19 TIMES.WHAT THIS? HOW CAN I USE THE MACRO MORE THAN 19 TIMES?
 

Ranman256

Registered User.
Local time
Today, 15:44
Joined
Apr 9, 2015
Messages
3,623
convert the macro to a procedure, then call the procedure. (inifinite times)

but what does the macro do that needs called that much?
 

June7

AWF VIP
Local time
Today, 11:44
Joined
Mar 9, 2014
Messages
3,368
Why would there be a limit on how many times a macro can be run? I don't use macros but I have never heard of such a limitation.
 

Isaac

Lifelong Learner
Local time
Today, 12:44
Joined
Mar 14, 2017
Messages
2,475
After researching this a bit, and not being a macro user myself, it sounds like perhaps a more helpful way to imagine/understand this limit, and sympathize with why it's there, has to do with this: It's not that you can't run a macro more than 19 times. You can. What you can't do, thankfully, is get into a recursive situation where the macro(s) you have created get "caught" in a seemingly infinite loop, and by their own definition: where the very actions you have requested the macro perform then trigger the same macro to keep running over and over ad infinitum.

In a way, this is much kinder than VBA, which will happily allow you to create the mistake where your code performs an infinite loop. Usually this happens when you create a spiderweb of Event driven code, where the action you are performing then triggers an Event which re-performs the[or another] action. (Excel provides a method of simply turning Application Events off at any given time, but Access does not, so interwoven events and triggers MUST be designed with that in mind).

To me the solution to this problem would be to re-think your macro creation and their purposes, and consider what you have done to cause that infinite loop of event-driven triggers and re-construct accordingly.
 
Last edited:

Micron

AWF VIP
Local time
Today, 15:44
Joined
Oct 20, 2018
Messages
3,469
Usually this happens when you create a spiderweb of Event driven code,
Sadly I can attest to the fact that all it takes is a simple procedure creating a loop over a recordset and forgetting to type
rs.MoveNext
 

Isaac

Lifelong Learner
Local time
Today, 12:44
Joined
Mar 14, 2017
Messages
2,475
Sadly I can attest to the fact that all it takes is a simple procedure creating a loop over a recordset and forgetting to type
rs.MoveNext
Yep. It's funny you say that.. I just did that earlier today with some code that created email drafts in Outlook. I only expected one and it took me a few seconds seeing multiple ones pop up before I realized what I had done
 

Micron

AWF VIP
Local time
Today, 15:44
Joined
Oct 20, 2018
Messages
3,469
For such things I usually set a counter =1 to rs.recordcount and remember to increment it. Last thing I want is a runaway email loop.
 

zainizizah

New member
Local time
Tomorrow, 03:44
Joined
Jul 5, 2020
Messages
4
Hi. Welcome to AWF!

Can you show us your macro? Thanks.
19 TIMES.jpg
 

zainizizah

New member
Local time
Tomorrow, 03:44
Joined
Jul 5, 2020
Messages
4
i use the macro as a button to open something like form or query. i make a system for statistic of sports.
 

arnelgp

error reading drive A:
Local time
Tomorrow, 03:44
Joined
May 7, 2009
Messages
10,604
convert the "other" macro into a Public Function that you can call several times.
 

onur_can

Member
Local time
Today, 12:44
Joined
Oct 4, 2015
Messages
114
I think use macros for simple operations. VBA codes are much stronger and faster. If you want to be good, you should always use the foremost technique.
 

Isaac

Lifelong Learner
Local time
Today, 12:44
Joined
Mar 14, 2017
Messages
2,475
i use the macro as a button to open something like form or query. i make a system for statistic of sports.
Re-read my initial post which explained why this happens and re-design accordingly.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:44
Joined
Oct 29, 2018
Messages
12,588
i use the macro as a button to open something like form or query. i make a system for statistic of sports.
Just as a quick test, I created a macro that calls itself and was able to make it call itself more than 100 times by using the Repeat Count argument.
 

Micron

AWF VIP
Local time
Today, 15:44
Joined
Oct 20, 2018
Messages
3,469
Just as a quick test, I created a macro that calls itself and was able to make it call itself more than 100 times by using the Repeat Count argument.
Was it a data macro like the one in question? That might make a difference.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:44
Joined
Oct 29, 2018
Messages
12,588
Was it a data macro like the one in question? That might make a difference.
Hmm, sorry, I didn't see any reference to a "data" macro. In which post number was it mentioned?
 

Micron

AWF VIP
Local time
Today, 15:44
Joined
Oct 20, 2018
Messages
3,469
i use the macro as a button to open something like form or query. i make a system for statistic of sports.
Hmm, maybe I read too much into that post, or was influenced by content at the links about the recursive macro call so I guess I'm all wet on that one.
Just read that a regular macro can call a data macro so I wonder if that could be at play also. It may be a data macro that's being recursive and raising the error?
I think OP needs to post a zipped copy of db so that the various factors can be more easily checked.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:44
Joined
Oct 29, 2018
Messages
12,588
Hmm, maybe I read too much into that post, or was influenced by content at the links about the recursive macro call so I guess I'm all wet on that one.
Just read that a regular macro can call a data macro so I wonder if that could be at play also. It may be a data macro that's being recursive and raising the error?
I think OP needs to post a zipped copy of db so that the various factors can be more easily checked.
Hi. Thanks for the clarification. Since a data macro doesn't really need a UI, I am not sure you will get the same error message prompt when using it. I haven't tried yet, so I am not entirely sure about that right now. However, I was able to duplicate the OP's error message using a UI macro.
 

Users who are viewing this thread

Top Bottom