Hi
I have created a very simple database to store my addresses. Now I would
like to add an index much like the one in the 'Northwinds' sample database.
Except I don't know how to use that example as I have only used Access once!
I have tried setting command buttons with each letter of the alphabet but my
problem is getting it to goto the field name starting with that letter?
Appreciate any expert's advise.
Thanks
Jim
What are you using to view your records: table view, or a form? Since
you mention "command buttons", I assume it's a form.
An index in a relational database management system (RDBMS) such as
MS-Access is, does NOT sort your data like an index in a dBase or
similar flat-file database. Depending on how many records are in the
table of addresses, you might not even need an index. All the index
does is to make it more efficient to pull specific records out of your
table when the selection criteria applies to the particular field(s)
upon which the index is built. Unles you have more than 500 - 1,000
addresses, you probably won't even notice the difference in speed when
selecting addresses with or without the index.
The table where you store your data should be considered to be like a
bucket of unordered items. These "items" are the records which get
entered into the table in some more or less random order. If you
import them from a text file or Excel spreadsheet where the data was
more or less sorted, then the native table order *might* reflect that
order. But once you have entered a new record, there is no facility to
put that record in order with the existing data unless you use a
select query.
IOW, you need to create a select query which sorts the data according
to criteria which you have to specify in the query (NOT in table view
.... these are ignored as soon as you try to set up your query). You
can change the sort order dynamically by using a form, or buttons on a
form, but first of all you need to be able to create a select query
which presents the data -- very similarly to the naked table view, but
filtered with the additional criteria.
The easiest thing to try (if you are in the query design view) is to
add the table to the query, then drag the "star" down to the first row
and column on the grid. Then drag the individual column names in the
order you wish the data to be sorted to the next columns in the grid.
Since the "star" means that all data in the table will be shown, you
can uncheck the "Show" checkbox for the additional columns, but be
sure to set the sort order to "Ascending" or "Descending" as the case
might be. Once it is working satisfactorily (click on the "!" button
on the toolbar to run the query and thus text it), save it under some
meaningful name.
After you get that working, you can use the query (NOT the table) as
the recordsource for the form. THEN you can use form controls to
further influence the sort order, selection criteria and other things
which you could not do with just the table.
But the sorting happens in the query (or directly in a report ... you
will need to set up additional sorting and maybe grouping rules when
you want to print out the data in a report because the report doesn't
honor the query's sorting criteria).
Let us know how you are doing ... I'm sure there are lots of people
here who remember their first adventures with Access and will be
willing to help you out!