Create Sort index (not primary) via code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you add sort properties to a table created via VBA? I can add a primary unique index, but can't figure out how to create table "cust" and have it sort by "cust_name" without making cust_name the promary unique index
Thanks
Dan
 
You don't. Records in tables don't have a predictable order. That's part of
relational database theory.

If the order is important, create a query with an ORDER BY clause in it, and
use the query wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Dan said:
How do you add sort properties to a table created via VBA? I can add a
primary unique index, but can't figure out how to create table "cust" and
have it sort by "cust_name" without making cust_name the promary unique
index.
 
If your table is big, also make the fields to be sorted on INDEXED - this will speed up sorting.
 
Back
Top