Macro recognizing when there is a record limitation

M

Mark M Simonian

I am using Access 97 and Windows 2000. I have a simple SetValue macro that
places a Now() into a date and time field and then moves to the next record
and places the date and time stamp two times more for a total of three
records. The query that generates the form rarely finds less than three
records so the macro halts if there are less than three.

I am trying to figure out how to have the macro run to complete up to three
records but not halt if there are less than three. This seems like VBA (I
don't go there) or can I define the macro to complete up to three records
when available?
*********************
Mark M. Simonian MD FAAP
Medical Director, ChildNet Medical Associates
5305 N Fresno St 105A
Fresno, CA 93710
(559) 221-7192
(e-mail address removed)
www.markmsimonian.medem.com
*************************
Alert: This email and any files transmitted with it
are intended solely for the use of the individual or
entity to whom they are addressed and may contain
confidential, patient health or other legally
privileged information. If you have received this
email in error please notify the sender by email,
delete and destroy this message and its attachments.
Any unauthorized review, use, disclosure,
or distribution is prohibited.
 
G

GJH

I am not sure what you want to do. If there are less than three records,
what do you want the macro to do, since it obviously cannot complete by
putting Now() into fields on records that are not there.

Is it perhaps that you do not want the macro to give an error, but to stop
gracefully if there is less than three records?

/Gordon
 
S

Steve Schapel

Mark,

It sounds like you have a query which can return the "up to three"
records you want to apply the time stamp to. You can make a separate
macro to use a RunMacro action to run the first macro, and in the
RepeatExpression argument, put the equivalent of...
DCount("*","YourQuery","[YourDateTimeField] Is Null")>0

However, if I understand your requirements, I feel it would be simpler
to use an Update Query to put your time stamp in the field of these
records in one hit, regardless of how many of them there are, and use
an OpenQuery action in your macro to run the Update.

- Steve Schapel, Microsoft Access MVP
 

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