counting records

A

Ant S

I want to be able to add a column to a query witch sequentially counts the
records in that query e.g. rec 1,2,3 etc. but each time the query runs it
may be in a different order and have a different number or records. I think
this should be a simple thing but I am new to this so struggling a bit.
Thanks for any help.
 
J

John Spencer

Why? This is not a simple thing to do in a query.

If you want the sequential number for detail lines in a report, then this is
not the way to accomplish the task.

In a report
== add a control to the section (txtLineCounter)
== Set the source of txtLineCounter to =1
== Set the Running Sum property to Overall

That will give you a sequential number.

If you really need to do it in a query, try downloading the sample Access
database at
http://lebans.com/rownumber.htm

That may solve the problem for you.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
A

Ant S

Thanks for your reply, the reason I am trying to do this is for a form so
there may be a more simple way to achieve this? I have a form which shows
images in a photo competition, I have removed the navigation buttons to cut
down on screen clutter as much as possible but would like a counter showing
how many images are still to view.
 
J

John Spencer

In a form, you will have to use a ranking query of some type. There is no
simple way to do it that I can think of.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

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