Record Numbers

N

nommy

Hi,

Is there any sql query which can retrieve records from a
table such that in the result the first field displays the
record number.

For Example:- There is a table which contains over 1000
records. Now running a query which displays all the
records such that the first field should display the
record numbers
Plz reply ASAP

Thanks,
Nommy.
 
M

Michel Walsh

Hi,


Not (right out of the box) with Jet. The safest and still fast way to
do it would be to insert the data into a new table having an autonumber
field (not replicated, not random ) and to append your SELECTED results
into it (without specifying any value for the autonumber field). The result
would be in the table. If you use a split design (back-end, front-end), I do
not see any reason to have that table in the back-end, built it in the front
end application.


Hoping it may help,
Vanderghast, Access MVP
 
P

Paal Andersen

"select count(*) as numbers from table"
there are rs.fields("numbers") records

Paal
 
J

John Vinson

Is there any sql query which can retrieve records from a
table such that in the result the first field displays the
record number.

No, since Access tables do not have record numbers.

Follow Michel's suggestion if you want to add a new field containing a
static record number; Paal's if you want to dynamically count records
retrieved by a query (bearing in mind that Record 31 today might be
Record 18 tomorrow).
 

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