473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Where are Indexes and Relationships stored, within Access MDB file?

Hello folks,

I'm developing a program that reads an access MDB file and produce
some scripts to rebuild the same structure against other databases
(MSSQL, MySQL and so on).

Reading structure of tables and fields was quite simple. Now I'm stuck
because I can't find where to read to access infos about indexes and
relationships. Probably for relationships I've to read the hidden
table MSysRelationships (I didn't do that 'till now), but I haven't
found anything about indexes.

Any suggestion?

TIA, tK
Nov 13 '05 #1
2 3282
Check the Relations collection:

Function ShowRel()
Dim db As DAO.Database
Dim rel As DAO.Relation
Dim fld As DAO.Field

Set db = CurrentDb()
For Each rel In db.Relations
Debug.Print rel.Name, rel.Table, rel.ForeignTable
For Each fld In rel.Fields
Debug.Print , fld.Name, fld.ForeignName
Next
Next

Set fld = Nothing
Set rel = Nothing
Set db = Nothing
End Function
Indexes belong to a TableDef:

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

--
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.

"tekanet" <te*****@inwind.it> wrote in message
news:81**************************@posting.google.c om...

I'm developing a program that reads an access MDB file and produce
some scripts to rebuild the same structure against other databases
(MSSQL, MySQL and so on).

Reading structure of tables and fields was quite simple. Now I'm stuck
because I can't find where to read to access infos about indexes and
relationships. Probably for relationships I've to read the hidden
table MSysRelationships (I didn't do that 'till now), but I haven't
found anything about indexes.

Any suggestion?

TIA, tK

Nov 13 '05 #2
te*****@inwind.it (tekanet) wrote in message news:<81**************************@posting.google. com>...
Hello folks,

I'm developing a program that reads an access MDB file and produce
some scripts to rebuild the same structure against other databases
(MSSQL, MySQL and so on).

Reading structure of tables and fields was quite simple. Now I'm stuck
because I can't find where to read to access infos about indexes and
relationships. Probably for relationships I've to read the hidden
table MSysRelationships (I didn't do that 'till now), but I haven't
found anything about indexes.

Any suggestion?

TIA, tK


If you're good enough at programming to be digging around the guts of
Access, you should probably own the Access Developer's Handbook by
Getz, Litwin, Gilbert/Gunderloy. there's code in there that does that
kind of thing - free with the book and very well worth the price of
the book.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: R Camarda | last post by:
I used Enterpise manager to make a backup of a SQL Database. When I restored it on another machine, I did not have any of my indexes. I checked the backup wizard and I could not find any reference...
1
by: Sampath Reddy | last post by:
Hi Everybody, We are using UDB v8.1 I will explain about my Stored procedures which we are executing in UDB AIX box. We have 3 millions(apporox) of data in 22 tables. By applying the business...
45
by: salad | last post by:
I'm curious about your opinion on setting relationships. When I designed my first app in Access I'd go to Tools/Relationships and set the relationships. Over time I'd go into the window and see...
14
by: Jeff | last post by:
This is the first time that I remember ever having too many indexes on a table, but it has happened. I have en employees table and store in many places, on tables, the id of the employee that...
10
by: racquetballguy | last post by:
Hi I have created a database for my kids to keep track of their swim team races. We use this to keep track of their speeds by stroke, fastest times, averages, etc. I am trying to add a new...
10
by: lesperancer | last post by:
you start with a small application in access97, then you have more modules and more... and you reach the point where tables like 'item' and 'employee' reach the limit and you know there's more...
1
by: Ron | last post by:
Hi All, I have relationships on a database built in the back end, but I'm wondering if that's where they should be. Can they be built in the front end but apply to all the back end tables? Can...
2
by: dgardner | last post by:
I have created a database with approximately 60 tables. One table "tblClients" needs to be linked with about 40 tables. Some are simply look up tables. Others hold multiple records for each client,...
4
by: netnewbie78 | last post by:
Hello All, I don't have a problem (but maybe I will after I explain). I have a question with regards to something I saw in Access 2007. But first, a little backstory: I'm writing a very small...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.