Last Record in a Table

  • Thread starter Thread starter thefonz37
  • Start date Start date
T

thefonz37

I have a macro that performs actions on data in a table and then advances to
the next record in that table. The issue I'd like to solve is that I would
like a custom message to pop up when the end of the data is reached, rather
than the somewhat-cryptic message that Access provides by default. Is there
a way to change this? Or is there a way to test if performing a "Next"
operation can complete or not? I'm kind of new to using criteria in macros,
so I'm not sure how this would work.
 
depends what version of Access you're using. i seem to remember someone
telling me that A2007 has error handling for macros, but not having that
version i can't verify. if you're using a prior version, you can't handle
errors in macros, you need to use VBA. if you've never used VBA, this is a
good time to get started; it's much more powerful and flexible than macros,
and you *can* learn it even if you've never used a programming language
before (i know this from experience <g>).

suggest you start by converting your macro to VBA. Access has a tool to do
this for you; in A2003, select the macro in the database window (you don't
need to open it), then click Tool | Macro | Convert Macros to Visual Basic.
go ahead and include error handling when asked, so you'll have an example of
how it's done. another thing you can do is add a command button to a form
using the Command Button Wizard, which will write basic code for the chosen
operation.

make liberal use of VBA Help, and come back to the newsgroups for help and
suggestions on how to learn more.

hth
 
Thefonz,

You can use a Condition in your macro like this:
[RecordsetClone].[RecordCount]>[CurrentRecord]
 
Back
Top