Looping Macros

  • Thread starter Thread starter Dunner
  • Start date Start date
D

Dunner

Hey guys,

I'm trying to setup a macro that will call a mail merge
document and then assign the time to a field on a bunch
of records. I have the first part done but I'm having
difficulty getting it to stamp all the records in a
specific form (the form having pulled out the records
that will need stamping).

Is it possible to loop the macro so that it runs from the
first to the last record in the form, stamping each one?
Also is it true that using the RunMacro command I can
only run it 20 times? This would cause major problems as
I envisage my database growing beyond 20 records in the
very near future, is there a better command I should use?

Thanks Guys

Dunner
 
Dunner,

This sounds like a job for an Update Query, which you can set up to
update the vlaue of your field to Time() and if you want to include
running this query into your macro, use the OpenQuery action.

I have heard before in this newsgroup of someone who came upon some sort
of 20 repetition limitation on the RunMacro action, but I have never
encountered it myself, and all my tests allow large numbers of
repetitions. But anyway, in your specific case, it seems to not be
relevant.
 
Hi Steve,

Thanks for the help, I'll have to look into creating an
update query to do the job. As for the 20 repitition
issue, that came up in a test macro I created. I think it
limits the number of times a macro can call itself. I had
moved on since and split it into two macros one calling
the other which doesn't seem to have any limits. Nice
little tit-bit of information to know though!

Thanks for your help

Dunner
 
Ah, calling the macro from itself would likely have this limitation because
of stacking limits.

However, using RepeatMacro action in a macro avoids that limitation because
it loops the macro instead of calling itself as a new macro.
 
Uncle Ken,

RepeatMacro???

I can't remember ever seeing this one. I just checked Access 97 and 2003.
(Only versions on this machine.) I can't find anything.

You sure???

Sco
 
Ack... memory is the first thing to go when you get old.

My reference meant to be to the Repeat Count or Repeat Expression part of
the RunMacro.

My understanding of the OP's note is that he was just calling his macro over
and over, without using the Repeat arguments. Thanks for the "memory jolt"!
 
Interesting.

The only time I do macros is in class to teach them.

I've never used RunMacro so I never noticed the Repeat args.

It's just sooo much easier to make a Do-Loop. :-)

Sco
 
M.L. Sco Scofield said:
Interesting.

The only time I do macros is in class to teach them.

I've never used RunMacro so I never noticed the Repeat args.


Old saying...them that can't do, teach?

< g , d, & rrrrrrrrrrrrr >
 
Back
Top