Repetitive Process Macro

F

FJquestioner

Can anyone assist me in designing the following macro?

I have a (continuous) form in which each record has a checkbox field which
the user manually clicks yes or no. I have a macro which performs certain
functions depending on whether or not the checkbox is clicked to yes. I have
it working fine for a form with a single record. However, when there are
several records, the macro needs to be able to start with the first record.
If the checkbox is clicked yes then perform its function. If its clicked no
then it moves to the next record. This process is repeated until the last
record is completed.

I don't know how to set up this process. Any suggestions would be greatly
appreciated.

Thanks.
 
S

Steve Schapel

FJ,

- Put an unbound textbox on the form, possibly in the header or
footer, with its Default Value property set to 0 - let's say you name
this textbox RecordsProcessed
- Put a SetValue action in the macro as well, with arguments set like
this...
Item: [RecordsProcessed]
Expression: [RecordsProcessed]+1
- Put a GoToRecord/Next action in the macro as well
- In the Condition column of the "perform certain functions" actions,
enter the equivalent of...
[NameOfYourCheckbox]=-1
... but do not include the SetValue and GoToRecord actions in the
Condition
- Make another macro, using the RunMacro action, to run the first
macro. This second macro is what you actually call from the event on
your form
- In the Repeat Expression argument of the RunMacro action in the
second macro, enter:
[RecordsProcessed]<=[Forms]![YourFormName].[RecordsetClone].[RecordCount]
 
F

FJquestioner

Thanks once again Steve !

Steve Schapel said:
FJ,

- Put an unbound textbox on the form, possibly in the header or
footer, with its Default Value property set to 0 - let's say you name
this textbox RecordsProcessed
- Put a SetValue action in the macro as well, with arguments set like
this...
Item: [RecordsProcessed]
Expression: [RecordsProcessed]+1
- Put a GoToRecord/Next action in the macro as well
- In the Condition column of the "perform certain functions" actions,
enter the equivalent of...
[NameOfYourCheckbox]=-1
... but do not include the SetValue and GoToRecord actions in the
Condition
- Make another macro, using the RunMacro action, to run the first
macro. This second macro is what you actually call from the event on
your form
- In the Repeat Expression argument of the RunMacro action in the
second macro, enter:
[RecordsProcessed]<=[Forms]![YourFormName].[RecordsetClone].[RecordCount]

--
Steve Schapel, Microsoft Access MVP
Can anyone assist me in designing the following macro?

I have a (continuous) form in which each record has a checkbox field which
the user manually clicks yes or no. I have a macro which performs certain
functions depending on whether or not the checkbox is clicked to yes. I have
it working fine for a form with a single record. However, when there are
several records, the macro needs to be able to start with the first record.
If the checkbox is clicked yes then perform its function. If its clicked no
then it moves to the next record. This process is repeated until the last
record is completed.

I don't know how to set up this process. Any suggestions would be greatly
appreciated.

Thanks.
 

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