473,435 Members | 1,581 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,435 software developers and data experts.

Looping table structure

Hi,

I want to link products and contacts, products and axctivities and
activities and contacts. I am using one to many links with full
referential integrity. Each table is linked to a table that defines the
possible relationship between either 2 tables.

My question is: does this increase the risk for data corruption or pose
other problems that need be taken into account before plunging in?

Thanks for your help guys!

Eskil

Nov 25 '05 #1
2 1427
Answers inline.

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

"eskil" <es********@hotmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...

I want to link products and contacts, products and axctivities and
activities and contacts. I am using one to many links with full
referential integrity.
That all sounds very good. No problem. It really helps reduce problems with
your database if you do everything you can at the engine-level:
relationships with RI, field-level validation, table-level validation,
setting AllowZeroLength to No, removing the zero Default Value and setting
Required for foreign key fields, and so on.
Each table is linked to a table that defines the
possible relationship between either 2 tables.
Not sure I understand this part of your question. Are you restating the same
as the previous paragraph? Or do you mean that you have created your own
table to store information about the relationships the table has? No need to
do that, as Access already has such as table (MSysRelationships), and you
can loop through the Relations collection quite easily. The function below
demonstates that.

My question is: does this increase the risk for data corruption or pose
other problems that need be taken into account before plunging in?


Public 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,
RelationAttributes(rel.Attributes)
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
Private Function RelationAttributes(lngAttrib As Long) As String
Dim strOut As String
Dim lngLen As Long
Const dbRelationCascadeNull As Long = &H2000

If (lngAttrib And dbRelationUnique) <> 0& Then
strOut = strOut & "unique, "
End If
If (lngAttrib And dbRelationDontEnforce) <> 0& Then
strOut = strOut & "unenforced, "
End If
If (lngAttrib And dbRelationInherited) <> 0& Then
strOut = strOut & "inherited, "
End If
If (lngAttrib And dbRelationUpdateCascade) <> 0& Then
strOut = strOut & "cascade update, "
End If
If (lngAttrib And dbRelationDeleteCascade) <> 0& Then
strOut = strOut & "cascade delete, "
End If
If (lngAttrib And dbRelationCascadeNull) <> 0& Then
strOut = strOut & "cascade to null, "
End If
If (lngAttrib And dbRelationLeft) <> 0& Then
strOut = strOut & "left join, "
End If
If (lngAttrib And dbRelationRight) <> 0& Then
strOut = strOut & "right join, "
End If
lngLen = Len(strOut) - 2& 'Without trailing comma and space.
If lngLen > 0& Then
RelationAttributes = Left$(strOut, lngLen)
End If
End Function
Nov 26 '05 #2
On 25 Nov 2005 09:16:59 -0800, "eskil" <es********@hotmail.com> wrote:
Hi,

I want to link products and contacts, products and axctivities and
activities and contacts. I am using one to many links with full
referential integrity. Each table is linked to a table that defines the
possible relationship between either 2 tables.

My question is: does this increase the risk for data corruption or pose
other problems that need be taken into account before plunging in?


In a word, no.

mike
Nov 26 '05 #3

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

Similar topics

2
by: JP SIngh | last post by:
Hi All Please can someone help me solve this issue. I have a database table the structure of which are given below. Profile Table EmployeeNumber FirstName
5
by: masood.iqbal | last post by:
My simplistic mind tells me that having local variables within looping constructs is a bad idea. The reason is that these variables are created during the beginning of an iteration and deleted at...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
6
by: Fuzzydave | last post by:
I am back developing futher our Python/CGI based web application run by a Postgres DB and as per usual I am having some issues. It Involves a lot of Legacy code. All the actual SQL Querys are...
1
by: RSH | last post by:
Hi, I have a situation in where I have a main loop that queries a "Parent" Global database table. Based on that resultset I loop through all of the databases and the appropriate table in the...
3
by: =?Utf-8?B?R3JlZyBTdGV2ZW5z?= | last post by:
I am connecting to an Oracle database using an OleDbConnection. I am using DataReader objects to get query results. However, this limits me to only having one reader open at a time, which is a...
0
by: NiteshR | last post by:
Hi, Please Help. I am writing a program that displays retrieves values from a SQL table and displays it. The Table contains a single column with many rows. I am able to retrieve the first record,...
1
by: Sweetiecakes | last post by:
Hello Is there an example of looping through a dataset filling an array with it? Thank you
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...
0
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...
0
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,...
0
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...
0
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.