Repeat a Macro Using an Expression


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
 
Ad

Advertisements

K

Ken Snell \(MVP\)

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
 
G

Guest

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
 
K

Ken Snell \(MVP\)

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
 
Ad

Advertisements

S

Steve Schapel

Agreed. There must have been something else awry in the original
expression - the "solution" as described doesn't really make sense.
 

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