Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

repeat expression for action: run macro

4 views
Skip to first unread message

Jolyn O

unread,
Oct 21, 2002, 7:25:02 PM10/21/02
to
I have a nested problem:
I am running macro B from macro A. At the end of macro B
I have GoToRecord(next). Is there a way to put a
condition in such as "unless this is the last record"? I
have tried setting the condition that a specific field
<>"", but I get the message "you may be at the end of the
record set." Which is, of course, where I want to be, but
without the error message.

I expect I will need to use a similar condition for the
repeat expression in the runmacro action in macro A.

Any help would be appreciated. Thanks.

Ken Snell

unread,
Oct 21, 2002, 7:54:59 PM10/21/02
to
I just tested this approach, and it seems to work.

The following condition will be true when you are not on the last record of
a form's recordsource:
DCount("*", [Forms]![FormName]![RecordSource]) <>
[Forms]![FormName].[CurrentRecord]

The following condition will be true when you are on the last record of a
form's recordsource:
DCount("*", [Forms]![FormName]![RecordSource]) =
[Forms]![FormName].[CurrentRecord]

You can use the above conditions to allow/disallow actions appropriately.
--
Hoping that this is helpful...
Ken Snell
<MS ACCESS MVP>

"Jolyn O" <joh...@ix.netcom.com> wrote in message
news:98e501c27959$14591d70$3aef2ecf@TKMSFTNGXA09...

Ken Snell

unread,
Oct 21, 2002, 8:15:53 PM10/21/02
to
Sorry for typo...... use these expressions instead:

The following condition will be true when you are not on the last record of
a form's recordsource:

DCount("*", [Forms]![FormName].[RecordSource]) <>


[Forms]![FormName].[CurrentRecord]

The following condition will be true when you are on the last record of a
form's recordsource:

DCount("*", [Forms]![FormName].[RecordSource]) =


[Forms]![FormName].[CurrentRecord]

--
Hoping that this is helpful...
Ken Snell
<MS ACCESS MVP>


"Ken Snell" <ksn...@comcast.net> wrote in message
news:eyySX0VeCHA.1656@tkmsftngp11...

Jolyn O

unread,
Oct 21, 2002, 8:39:00 PM10/21/02
to
Thanks for your prompt response.
I'm not familiar with [RecordSource] or [CurrentRecord]
(and can't find them in my many books). I thought they
might be recognized by Access as they are, so tried them,
but have gotten into an error message loop I can't get out
of. (I'll just get out of Access.)
Are these supposed to be specific fields on my form? I
get myself in over my head pretty quickly, and am grateful
for your help.
Thanks, Jolyn
>.
>

Jolyn O.

unread,
Oct 22, 2002, 2:48:23 PM10/22/02
to
It works! The only challenge was that it stopped on the
last record, and didn't run macro B, but I fixed that by
having it run macro B one more time. Success! Thanks
very much. Jolyn
>.
>

Ken Snell

unread,
Oct 22, 2002, 11:11:18 PM10/22/02
to
RecordSource is a property of the form. It is the "query" upon which your
form is based. Using it in the DCount function allows that function to
determine the number of records that are in the form's recordsource (and
therefore how many records you have for the form).

CurrentRecord is a property of the form, too. It is the number of the record
that currently is displayed on the form. When CurrentRecord number equals
the number returned by DCount, you're displaying the last record for the
form.

--
Hoping that this is helpful...
Ken Snell
<MS ACCESS MVP>

"Jolyn O" <joh...@ix.netcom.com> wrote in message

news:998b01c27963$6a07bb50$3aef2ecf@TKMSFTNGXA09...

Ken Snell

unread,
Oct 22, 2002, 11:09:18 PM10/22/02
to
You're welcome.

"Jolyn O." <joh...@ix.netcom.com> wrote in message
news:ae0001c279fb$99888b50$35ef2ecf@TKMSFTNGXA11...

0 new messages