Michael:
I think you're right that you can't do what XwEYEr wants in a query but I thought it might be an interesting exercise to try creating a function to assign row numbers.
I created the following function:
Public Function Counter(strCount As String) As Integer
Static intCounter As Integer
If IsNull(strCount) Then
Exit Function
Else
intCounter = intCounter + 1
End If
Counter = intCounter
End Function
Then I set up a query with a field called Number that called the function and passed the value of a name field that should always contain data.
The function works, but I got spurious results on the row numbers.
The first time I ran the query it returned 2 for the first record and then 8, 9, 10, 11, 12 for the remainder of rows. A curious twist -- when I printed the results, it came out numbered 13 through 18. I assume that in formatting for the print output it ran through the function again for each row to be printed.
Of course, since the counter variable is defined as static it doesn't reset if you run the query again before closing the db. Thus, the next run was numbered 14 to 19; the third 21 to 26 and so on skipping two numbers between runs.
This is a good challenge for the technically advanced out there in Tek Tip land. First, is it possible to do what XwEYEr wants in a query and/or function. Second, if possible how is it done.
[sig]<p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br> [/sig]