How to number items in query

G

Guillaume Hanique

Hello!

I have a query that gets a subset of a table and sorts it. What I'd
like to do, is number the items in the query. So suppose the query
returns:

Mr Smith
Mr Johnson
Mr Whatever

What I would like is

1 Mr Smith
2 Mr Johnson
3 Mr Whatever

I tried writing a function in MS Access that returns a unique value
each time it is called, but it is only called once, so all the
"unique" numbers are the same.

Anybody an idea on how to achive this?

Thanks,
Guillaume Hanique.
 
T

tina

-----Original Message-----
Hello!

I have a query that gets a subset of a table and sorts it. What I'd
like to do, is number the items in the query. So suppose the query
returns:

Mr Smith
Mr Johnson
Mr Whatever

What I would like is

1 Mr Smith
2 Mr Johnson
3 Mr Whatever

I tried writing a function in MS Access that returns a unique value
each time it is called, but it is only called once, so all the
"unique" numbers are the same.

Anybody an idea on how to achive this?

Thanks,
Guillaume Hanique.
.
pass a value to your function to force it to run for each
record. it doesn't matter what field in the query you pass
to the function, because you don't need to actually use
the value in the function itself.
 
G

Guillaume Hanique

Thanks, that's it.

It's so simple, but I just didn't seet it.

Thanks again,
Guillaume Hanique.
 

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