If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Indexes, Primary Keys and Relationships in MS Access
Hi,
How can i query/get the following in an MS Access 2002 Database: - 1. List of Indexed Fields in the MDB 2. All the Primary Key Fields in the MDB 3. List of Constraints/Foreign Key relationships in the MDB Is there some way to query this information instead of going table by table in the design view? Thanks! |
#2
|
|||
|
|||
Indexes, Primary Keys and Relationships in MS Access
You can access these things programmatically.
This example lists the names of the relationships in the current database, including the table and foreign table. Each relation has other properties as well. Function ShowRel() Dim db As DAO.Database Dim rel As DAO.Relation Set db = CurrentDb() For Each rel In db.Relations Debug.Print rel.Name, rel.Table, rel.ForeignTable Next Set rel = Nothing Set db = Nothing End Function -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Naveen" wrote in message ... How can i query/get the following in an MS Access 2002 Database: - 1. List of Indexed Fields in the MDB 2. All the Primary Key Fields in the MDB 3. List of Constraints/Foreign Key relationships in the MDB Is there some way to query this information instead of going table by table in the design view? Thanks! |
#3
|
|||
|
|||
Indexes, Primary Keys and Relationships in MS Access
Thanks! This works.
I was curious to know if there was some way to query the MDB and get the information instead of coding. Thank you, -----Original Message----- You can access these things programmatically. This example lists the names of the relationships in the current database, including the table and foreign table. Each relation has other properties as well. Function ShowRel() Dim db As DAO.Database Dim rel As DAO.Relation Set db = CurrentDb() For Each rel In db.Relations Debug.Print rel.Name, rel.Table, rel.ForeignTable Next Set rel = Nothing Set db = Nothing End Function -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Naveen" wrote in message ... How can i query/get the following in an MS Access 2002 Database: - 1. List of Indexed Fields in the MDB 2. All the Primary Key Fields in the MDB 3. List of Constraints/Foreign Key relationships in the MDB Is there some way to query this information instead of going table by table in the design view? Thanks! . |
#4
|
|||
|
|||
Indexes, Primary Keys and Relationships in MS Access
This is undocumented, but may help:
SELECT MSysRelationships.* FROM MSysRelationships; -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Naveen" wrote in message ... Thanks! This works. I was curious to know if there was some way to query the MDB and get the information instead of coding. Thank you |
#5
|
|||
|
|||
Indexes, Primary Keys and Relationships in MS Access
Thanks!
-----Original Message----- This is undocumented, but may help: SELECT MSysRelationships.* FROM MSysRelationships; -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Naveen" wrote in message ... Thanks! This works. I was curious to know if there was some way to query the MDB and get the information instead of coding. Thank you . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
More assistance with Many to Many Relationships | Lynn | Database Design | 3 | July 9th, 2004 04:22 PM |
Many to Many Relationships | Lynn | Database Design | 7 | July 9th, 2004 03:08 PM |
Access 2002 - Many to Many Relationships | Lynn | General Discussion | 5 | July 8th, 2004 12:55 AM |
Establishing Relationships with ID numbers as foreign keys | lybargera | Database Design | 2 | June 16th, 2004 07:30 PM |
Primary Keys and Relationships | TR | Database Design | 2 | May 23rd, 2004 03:19 AM |