Number Results of Query

K

Kevin Schulhof

This sounds like a simple task but I am having trouble doing it.

Need to create a row number for the results of a query so that I can use this:

==============
Referring to a Field in the Previous Record or Next Record
at:
http://support.microsoft.com/kb/210504/en-us
==============

Anyone know how to creat a number and increment it so that you have a
sequential list in your query result?

Really would appreciate the help.
 
J

James A. Fortune

Kevin said:
This sounds like a simple task but I am having trouble doing it.

Need to create a row number for the results of a query so that I can use this:

==============
Referring to a Field in the Previous Record or Next Record
at:
http://support.microsoft.com/kb/210504/en-us
==============

Anyone know how to creat a number and increment it so that you have a
sequential list in your query result?

Really would appreciate the help.

Try:
http://groups.google.com/group/comp...be5c3a2d2bb/a09960a085d2f378#a09960a085d2f378

James A. Fortune
[email protected]
 
K

Kevin Schulhof

I added that function as a module...and added it in a column of the
query...like this:

counterid: linenum([Payment_Data.Payment_ID],"Interest
Query",[Payment_Data.Payment_ID])

Payment_ID is my unique key in the main table...interest query is the query
this is running.

I get an error that says that...

The expression you entered as a query parameter produced this error:
Database can't find the name '9282' you entered in the expression.

It so happens that 9282 is the very first payment_id in my main table.

I don't know where to go from here...any ideas would really be appreciated!!!
 
J

James A. Fortune

Kevin said:
I added that function as a module...and added it in a column of the
query...like this:

counterid: linenum([Payment_Data.Payment_ID],"Interest
Query",[Payment_Data.Payment_ID])

Payment_ID is my unique key in the main table...interest query is the query
this is running.

I get an error that says that...

The expression you entered as a query parameter produced this error:
Database can't find the name '9282' you entered in the expression.

It so happens that 9282 is the very first payment_id in my main table.

I don't know where to go from here...any ideas would really be appreciated!!!

It's looking for a table with the name of your first Payment_ID value.

Try:

counterid: linenum([Payment_Data],"[Interest Query]", "Payment_ID")

James A. Fortune
[email protected]
 
J

James A. Fortune

James said:
Kevin said:
I added that function as a module...and added it in a column of the
query...like this:

counterid: linenum([Payment_Data.Payment_ID],"Interest
Query",[Payment_Data.Payment_ID])

Payment_ID is my unique key in the main table...interest query is the
query this is running.

I get an error that says that...

The expression you entered as a query parameter produced this error:
Database can't find the name '9282' you entered in the expression.

It so happens that 9282 is the very first payment_id in my main table.

I don't know where to go from here...any ideas would really be
appreciated!!!


It's looking for a table with the name of your first Payment_ID value.

Try:

counterid: linenum([Payment_Data],"[Interest Query]", "Payment_ID")

James A. Fortune
[email protected]

Oops. That's not right either. Try:

counterid: linenum([Payment_ID],"Payment_Data", "Payment_ID")

if the query is based on the table Payment_Data,

counterid: linenum([Payment_ID],"[Interest Query]", "Payment_ID")

if the query is based on the query [Interest Query] containing the field
Payment_ID from table Payment_Data.

Hope this helps,

James A. Fortune
[email protected]
 
K

Kevin Schulhof

James - you're the man...this thing is almost perfect now.

One strange and unexpected issue has occured. Do you have any ideas on this?

The query sorts first by Loan Name, then by Individual, then by date...at
least that is what it is supposed to do...and works in most cases...but in
some cases, it is sorting by date then by Individual.

Any idea why this might be occuring? My columns indicate to sort in the
order above. I tried to move the counter up before date...but that did not
work).

I guess I will try to do the first query, and sort...then run the second
query against the first.

Thanks again for all of your assistance.

Kevin

James A. Fortune said:
James said:
Kevin said:
I added that function as a module...and added it in a column of the
query...like this:

counterid: linenum([Payment_Data.Payment_ID],"Interest
Query",[Payment_Data.Payment_ID])

Payment_ID is my unique key in the main table...interest query is the
query this is running.

I get an error that says that...

The expression you entered as a query parameter produced this error:
Database can't find the name '9282' you entered in the expression.

It so happens that 9282 is the very first payment_id in my main table.

I don't know where to go from here...any ideas would really be
appreciated!!!


It's looking for a table with the name of your first Payment_ID value.

Try:

counterid: linenum([Payment_Data],"[Interest Query]", "Payment_ID")

James A. Fortune
[email protected]

Oops. That's not right either. Try:

counterid: linenum([Payment_ID],"Payment_Data", "Payment_ID")

if the query is based on the table Payment_Data,

counterid: linenum([Payment_ID],"[Interest Query]", "Payment_ID")

if the query is based on the query [Interest Query] containing the field
Payment_ID from table Payment_Data.

Hope this helps,

James A. Fortune
[email protected]
 
J

James A. Fortune

Kevin said:
James - you're the man...this thing is almost perfect now.

One strange and unexpected issue has occured. Do you have any ideas on this?

The query sorts first by Loan Name, then by Individual, then by date...at
least that is what it is supposed to do...and works in most cases...but in
some cases, it is sorting by date then by Individual.

Any idea why this might be occuring? My columns indicate to sort in the
order above. I tried to move the counter up before date...but that did not
work).

I guess I will try to do the first query, and sort...then run the second
query against the first.

Try your guess first. That should work. If that doesn't work, show a
table with a couple of fields and records that demonstrate what you want
to do along with your desired output in a reply here and we'll go from
there.

James A. Fortune
[email protected]
 
Top