Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indexing a phone book

1 view
Skip to first unread message

Mike Turco

unread,
Feb 6, 2005, 12:27:24 AM2/6/05
to
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?


Morning DJ

unread,
Feb 6, 2005, 1:10:30 AM2/6/05
to

Easy. Put some VBA into the Report (probably on the Format event, but
I can imagine it can put in a number of different places) that writes
what you want to "recall" to a temporary table.

Then use that table as the basis for your index report.

DJ

jimfo...@compumarc.com

unread,
Feb 6, 2005, 1:12:28 AM2/6/05
to

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

0 new messages