Conditional Loop in Macro

  • Thread starter Thread starter Jeff H
  • Start date Start date
J

Jeff H

I need to be to loop a series of queries in macro until a condition is met. I
can't quite figure out how to do it.

For each job activity the client has had, he/she has a possibility of having:
Placement Milestone
1-Month Milestone
3-Month Milestone
6-Month Milestone
9-Month Milestone

Some initial milestones for clients are missing. For example, a client may
have a 6-month milestone for an activity but be missing the placement,
1-month and 3-month milestones.

I have the correct queries created. I just need help creating the
conditional loop in the macro I need to run periodically to catch any new
records meeting the criteria.

Logic:

Marker1
Query1: Make table of "faux" milestones to append.
If Record_Count("faux" table) = 0 GoTo EndMacro
Append "faux" records to milestone table
GoTo Marker1
EndMacro

Any help would be appreciated. If there is a more efficient way than a
macro, let me know.
 
Jeff,

Assuming I understand you correctly (which is not guaranteed because I do
not completely follw everything you wrote), you can make a second macro,
using a RunMacro action, to run the existing macro. And in the Repeat
Expression argument, it looks like you need this:
DCount("*","faux")>0

--
Steve Schapel, Microsoft Access MVP


Jeff H said:
I need to be to loop a series of queries in macro until a condition is
met. I
can't quite figure out how to do it.

For each job activity the client has had, he/she has a possibility of
having:
Placement Milestone
1-Month Milestone
3-Month Milestone
6-Month Milestone
9-Month Milestone

Some initial milestones for clients are missing. For example, a client may
have a 6-month milestone for an activity but be missing the placement,
1-month and 3-month milestones.

I have the correct queries created. I just need help creating the
conditional loop in the macro I need to run periodically to catch any new
records meeting the criteria.

Logic:

Marker1
Query1: Make table of "faux" milestones to append.
If Record_Count("faux" table) = 0 GoTo EndMacro
Append "faux" records to milestone table
GoTo Marker1
EndMacro

Any help would be appreciated. If there is a more efficient way than a
macro, let me know.



__________ Information from ESET Smart Security, version of virus signature database 4189 (20090625) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Back
Top