I need a function to loop a macro until a field reaches 0

jconverse

New member
Local time
Today, 04:25
Joined
Apr 28, 2009
Messages
4
Thanks in advance!! I really have been out of VBA and Access for 5 years and have lost some of my edge. I need to loop a macro from a Function until a field in the Table [MakeRatio]![ASK] reaches 0. I can take care of the counting within the macro but I need to call a function from RUNCODE in a macro.
 
I'm confused, you want to loop a macro from a function or call a function from a macro? You can use DLookup() to check the table value in your loop and exit when it's 0.
 
I'm confused, you want to loop a macro from a function or call a function from a macro? You can use DLookup() to check the table value in your loop and exit when it's 0.
Can you get me started on what it would look like?
 
Code:
I can take care of the counting within the macro but I need to call a function from RUNCODE in a macro.

That's some Inception level processing you want to undertake. Why not just do the whole thing in VBA?

As pbaldy mentioned--you haven't given us any code and you haven't really specificied what part of the coding is tripping you up. So, give it a shot yourself (even if its just pseudo-code), if it doesn't work then post code and ask us about specific lines of codes or methods.
 
Did you mean to say that you want to call this code inside of a SUB, rather than inside of a function? It would be kind of odd to call code from within a function, clearly not that it could never happen but it would be less common
 
A Sub is just a Function that doesn't return anything. Don't know why a sub would be more/less likely to do anything a function does.
 
I was wrong, there's another difference--you cannot call a Sub from a macro, but you can call a Function from a macro. But that just underscores that he definitely meant Function.
 
I definitely think it would be less common to call other code from within a function. Yes I'm quite aware of what a function and sub are. Anyway, we can wait till he clarifies
 

Users who are viewing this thread

Back
Top Bottom