Mike Turco wrote:
I'm creating a fairly phone book for an organization (maybe 400
pages). Members are listed out by chapter with their phone number and all
that. There is also to be an index by last name. In creating the index by
last name, how do I find out what page a person's name is on in the
chapter directory?
This is probably useless but if the records are the same vertical size
then you could add a rownumber to a query that's the same as the one
used to build the chapter. I came up with a way to add the rownumbers
then googled and saw that many others used the same technique in the
past.
Technique illustrated:
tblInvoices
InvoiceID InvoiceDate SupplierID Data
1 1/1/05 18 Some data
3 1/2/05 23 More data
5 1/3/05 9 Even more data
where InvoiceID is an autonumberfield.
qryInvoices
SELECT InvoiceID, InvoiceDate, SupplierID, Data FROM tblInvoices ORDER
BY InvoiceId;
qryInvoiceWithRecordNumber
SELECT (SELECT Count(A.InvoiceId) + 1 FROM qryInvoices As A WHERE
A.InvoiceID < qryInvoices.InvoiceID) AS RecordNumber,
qryInvoices.InvoiceID, qryInvoices.InvoiceDate, qryInvoices.SupplierID,
qryInvoices.Data FROM qryInvoices;
gives:
RecordNumber InvoiceID Date SupplierID Data
1 1 1/1/05 18 Some data
2 3 1/2/05 23 More data
3 5 1/3/05 9 Even more data
Then you can use (RecordNumber - 1) \ RecordsPerPage + 1 to get what
page they're on.
James A. Fortune