MACROS CAN ONLY BE CALLED 19 TIMES (1 Viewer)

zainizizah

New member
Local time
Tomorrow, 04:55
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

Well-known member
Local time
Today, 16:55
Joined
Apr 9, 2015
Messages
4,339
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, 12:55
Joined
Mar 9, 2014
Messages
5,423
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, 13:55
Joined
Mar 14, 2017
Messages
8,738
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, 16:55
Joined
Oct 20, 2018
Messages
3,476
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, 13:55
Joined
Mar 14, 2017
Messages
8,738
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, 16:55
Joined
Oct 20, 2018
Messages
3,476
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, 04:55
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, 04:55
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:55
Joined
May 7, 2009
Messages
19,169
convert the "other" macro into a Public Function that you can call several times.
 

onur_can

Active member
Local time
Today, 13:55
Joined
Oct 4, 2015
Messages
180
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, 13:55
Joined
Mar 14, 2017
Messages
8,738
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, 13:55
Joined
Oct 29, 2018
Messages
21,358
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, 16:55
Joined
Oct 20, 2018
Messages
3,476
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, 13:55
Joined
Oct 29, 2018
Messages
21,358
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, 16:55
Joined
Oct 20, 2018
Messages
3,476
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, 13:55
Joined
Oct 29, 2018
Messages
21,358
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