Conditional Loop in Macro

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.
 
S

Steve Schapel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top