473,769 Members | 7,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 MSysRelationshi ps (I didn't do that 'till now), but I haven't
found anything about indexes.

Any suggestion?

TIA, tK
Nov 13 '05 #1
2 3314
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.ForeignTabl e
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(str Table 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(st rTable)
For Each ind In tdf.Indexes
Debug.Print ind.Name, IIf(ind.Primary , "Primary", ""), _
IIf(ind.Foreign , "Foreign", ""), ind.Fields.Coun t
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.goo gle.com...

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 MSysRelationshi ps (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.go ogle.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 MSysRelationshi ps (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
1789
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 to including or not indexes. Are my indexes there, but not built? Maybe a stored procedure I need to run to rebuild them? TIA Rob
1
2607
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 logic through Stored procedures on 22 tables and writing into 3 new tables. We have used all temporary tables except starting 22 tables. The Stored procedures we have used nearly 6 temporary tables to handle the business logic. Finally we are loading...
45
3423
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 relationship spaghetti....tables/queries all overthe place with lots of relationship lines between here and there. After that first app I didn't do relationships. If I had a query, I defined the relationship. Many of the times when I create a...
14
19682
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 performed some action. Yes, I know, that could be in an audit trail but it isn't. For example, who printed a sales order, who processed it etc is stored on the sales orders table. Well, I have run out of indexes on the employees table when trying...
10
2128
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 module, pulled from a form, created from a query, that will calculate if they have qualified for district championships or not. The module works fine, but I cannot write the calculated results back to the table. I think the problem is with my table...
10
2702
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 indexes required for RI to come does creating a RI programatically instead of the relationship window still consume one of the 32 indexes ? does access2000 / 2003 allow more indexes per table ?
1
1670
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 someone advise? Here's the scenario. User has a choice upon first entry of the program to go into one of 10 separate databases, all with the same tables but with different data stored in each... let's say "office". They go into "Office 1"...
2
3158
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, for example children information. (One client can have many children.) Other tables are linked to tblClients and have a one-to-one relationship. This is because many of the clients will not have any data in the fields, for example, marital...
4
4386
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 stock database. For now, it will simply track what products come in (Stocks bought by Project) and what products go out (Stocks sold to by Project) . There are three tables: Products, Transactions and Projects.
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.