Repeat a Macro Using an Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to repeat a macro for several months of data by placing this
expression in the RunMacro expression field - Forms![frm_Params]![FinalDate]
Forms![frm_Params]![ProcessingDate]. [ProcessingDate] gets incremented at
the end of the macro before it should loop.
It just is not looping. If I enter a repeat count, and leave the expression
blank, my macro repeats 4 times and works perfectly. I thought it might be
some problem with the date formats, although they are both Short Dates. To
try to test a possible date format problem, I used count instead and
incremented the count. Did not work. I also set the expression to 1=3, and
set repeat to 4 times to stop an unending loop, and it evaluated to "true"
and ran only once.
Please help
 
ON the assumption that the form's textbox is being seen as a text value and
not a date value, try this:

CDate(Forms![frm_Params]![FinalDate]) >
CDate(Forms![frm_Params]![ProcessingDate])


--

Ken Snell
<MS ACCESS MVP>

GeorgieGirl said:
I am trying to repeat a macro for several months of data by placing this
expression in the RunMacro expression field -
Forms![frm_Params]![FinalDate]
Forms![frm_Params]![ProcessingDate]. [ProcessingDate] gets incremented
at
the end of the macro before it should loop.
It just is not looping. If I enter a repeat count, and leave the
expression
blank, my macro repeats 4 times and works perfectly. I thought it might
be
some problem with the date formats, although they are both Short Dates.
To
try to test a possible date format problem, I used count instead and
incremented the count. Did not work. I also set the expression to 1=3,
and
set repeat to 4 times to stop an unending loop, and it evaluated to "true"
and ran only once.
Please help
 
Ken,
Thanks for the quick response. The format you provided did not work.
However, it was because I talked you into having an exclamation point before
the control name instead of a period. After I changed this to a period it
worked, even without the CDate.

The eye sees what the eye wants to see. Thanks again.

Ken Snell (MVP) said:
ON the assumption that the form's textbox is being seen as a text value and
not a date value, try this:

CDate(Forms![frm_Params]![FinalDate]) >
CDate(Forms![frm_Params]![ProcessingDate])


--

Ken Snell
<MS ACCESS MVP>

GeorgieGirl said:
I am trying to repeat a macro for several months of data by placing this
expression in the RunMacro expression field -
Forms![frm_Params]![FinalDate]
Forms![frm_Params]![ProcessingDate]. [ProcessingDate] gets incremented
at
the end of the macro before it should loop.
It just is not looping. If I enter a repeat count, and leave the
expression
blank, my macro repeats 4 times and works perfectly. I thought it might
be
some problem with the date formats, although they are both Short Dates.
To
try to test a possible date format problem, I used count instead and
incremented the count. Did not work. I also set the expression to 1=3,
and
set repeat to 4 times to stop an unending loop, and it evaluated to "true"
and ran only once.
Please help
 
Actually, the exclamation point is correct if FinalDate is the name of a
control on the form. If it's just a field and not a control, then you need
to use the period.
--

Ken Snell
<MS ACCESS MVP>



GeorgieGirl said:
Ken,
Thanks for the quick response. The format you provided did not work.
However, it was because I talked you into having an exclamation point
before
the control name instead of a period. After I changed this to a period it
worked, even without the CDate.

The eye sees what the eye wants to see. Thanks again.

Ken Snell (MVP) said:
ON the assumption that the form's textbox is being seen as a text value
and
not a date value, try this:

CDate(Forms![frm_Params]![FinalDate]) >
CDate(Forms![frm_Params]![ProcessingDate])


--

Ken Snell
<MS ACCESS MVP>

GeorgieGirl said:
I am trying to repeat a macro for several months of data by placing this
expression in the RunMacro expression field -
Forms![frm_Params]![FinalDate]
Forms![frm_Params]![ProcessingDate]. [ProcessingDate] gets
incremented
at
the end of the macro before it should loop.
It just is not looping. If I enter a repeat count, and leave the
expression
blank, my macro repeats 4 times and works perfectly. I thought it
might
be
some problem with the date formats, although they are both Short Dates.
To
try to test a possible date format problem, I used count instead and
incremented the count. Did not work. I also set the expression to
1=3,
and
set repeat to 4 times to stop an unending loop, and it evaluated to
"true"
and ran only once.
Please help
 
Agreed. There must have been something else awry in the original
expression - the "solution" as described doesn't really make sense.
 
Back
Top