MACROS CAN ONLY BE CALLED 19 TIMES

zainizizah

New member
Local time
Today, 21:08
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?
 
convert the macro to a procedure, then call the procedure. (inifinite times)

but what does the macro do that needs called that much?
 
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.
 
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:
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
 
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
 
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.
 
Hi. Welcome to AWF!

Can you show us your macro? Thanks.
19 TIMES.jpg
 
i use the macro as a button to open something like form or query. i make a system for statistic of sports.
 
convert the "other" macro into a Public Function that you can call several times.
 
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.
 
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.
 
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.
 
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.
 
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?
 
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.
 
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

Back
Top Bottom