Count Records returned by Query

  • Thread starter Thread starter Anand
  • Start date Start date
A

Anand

Hi all,
Can someone please tell me how to count the records
returned by an action query (or any query). I get a
warning message from Access2000 that so many records are
going to be updated/appended/deleted etc. But I want to
be able to trap this information in code so that I use it
inform the user.

Thanks in advance
Anand
 
Dear Anand:

You can write a query that shows this number and run this before
updating. This would be a "Totals Query" having a COUNT() of the rows
affected. There would be a separate query for "updated", "appended",
and "deleted" if you indeed have a potential for all three types of
changes.

There is a tiny chance that the numbers generated by such queries will
not be exactly accurate. This is because the query to count rows
affected would be run before the query to perform the changes. If
some user of the database makes a change during this brief period
(probably a fraction of a second) the count could change. This is
probably not critical, but if it is, you would have to make a
temporary table of the changes, then perform the changes using that
temporary table. After making such changes, additional work would be
required to determine which changes failed due to user changes to the
database.

Hi all,
Can someone please tell me how to count the records
returned by an action query (or any query). I get a
warning message from Access2000 that so many records are
going to be updated/appended/deleted etc. But I want to
be able to trap this information in code so that I use it
inform the user.

Thanks in advance
Anand

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Thanks for the info Tom. I was out of town for a few days
and couldnt see your reply sooner.

Thanks again
Anand
 
Back
Top