Linked table and indexes

G

Guest

I have table1 in database1.mdb. database2.mdb links to table1. table1 has an
index. But when I pull up the designer on table1 from database2.mdb, I do not
see the index. Is the index just not viewable from database2.mdb, or is the
index not usable from database2.mdb?

Brenda
 
A

Allen Browne

You cannot create or modify the linked table's index, but it should be
visible and Access should use it.

Open the Immediate window (Ctrl+G)

Enter something like this to see how many indexes the table has:
? currentdb.TableDefs("MyTable").Indexes.Count
replacing "MyTable" with the name of your table.
(Note that there can be hidden indexes.)

You can use the function below to list the indexes.

Name AutoCorrect can mess up the indexes. More on that:
http://members.iinet.net.au/~allenbrowne/bug-03.html


Function ShowIndexes(strTable As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim ind As DAO.Index
Dim fld As DAO.Field

Set db = DBEngine(0)(0)
Set tdf = db.TableDefs(strTable)
For Each ind In tdf.Indexes
Debug.Print ind.Name, IIf(ind.Primary, "Primary", ""), _
IIf(ind.Foreign, "Foreign", ""), ind.Fields.Count
Debug.Print " Field(s): ";
For Each fld In ind.Fields
Debug.Print fld.Name;
Next
Debug.Print
Next

Set ind = Nothing
Set tdf = Nothing
Set db = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top