473,508 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Relationships question

ARC
Hello all,

Prior to going live with my app, I have questions on relationships theory.

My prior app was done in Access 97, and I did NOT use relationships at all.
I have 65 tables in my back-end database, and with Access 97, if you added
relationships, it would add multiple copies of the same relationships over
and over, so I decided not to use any relationships at all.

Additionally, when I needed to add or remove fields via code, it was a lot
easier without relationships, as you didn't need to worry about adding
relationships when adding new fields, or removing them if you needed to
delete an obsolete field.

So the question is, I'm about to deploy the app, re-worked in in Access
2007, and with the 65 tables, The relationships screen in the back-end
database is very full. I would think that so many relationships would
actually slow the database down, and would make table maintenance much more
difficult in the future.

Can anyone give me their opinions, pros and cons, on whether to have
relationships or not?

Many thanks,

--
Andy
Aug 20 '07 #1
13 2038
On Mon, 20 Aug 2007 13:27:55 GMT, "ARC" <an**@andyc.comwrote:

Yes, such a db would be slower (there are additional indexes and
checks to be made), but the difference is not noticible and the effect
is negligible compared to the ENORMOUS benefit of data integrity.

I'm sure if you went back to your A97 db, you could pretty easily find
orphaned data, couldn't you?

-Tom.
>Hello all,

Prior to going live with my app, I have questions on relationships theory.

My prior app was done in Access 97, and I did NOT use relationships at all.
I have 65 tables in my back-end database, and with Access 97, if you added
relationships, it would add multiple copies of the same relationships over
and over, so I decided not to use any relationships at all.

Additionally, when I needed to add or remove fields via code, it was a lot
easier without relationships, as you didn't need to worry about adding
relationships when adding new fields, or removing them if you needed to
delete an obsolete field.

So the question is, I'm about to deploy the app, re-worked in in Access
2007, and with the 65 tables, The relationships screen in the back-end
database is very full. I would think that so many relationships would
actually slow the database down, and would make table maintenance much more
difficult in the future.

Can anyone give me their opinions, pros and cons, on whether to have
relationships or not?

Many thanks,
Aug 20 '07 #2
ARC
I just added the relationships in 2007, I didn't set any referential
integrities.

You're right about my 97 app. For example, when they wanted to delete a
customer, I ran code that would delete records in other tables, such as a
letters table, quotes, quote details, etc., and I would sometimes deleting
from a table.

So by orphaned data, do you mean to make sure I use the options to maintain
referential integrity?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:ue********************************@4ax.com...
On Mon, 20 Aug 2007 13:27:55 GMT, "ARC" <an**@andyc.comwrote:

Yes, such a db would be slower (there are additional indexes and
checks to be made), but the difference is not noticible and the effect
is negligible compared to the ENORMOUS benefit of data integrity.

I'm sure if you went back to your A97 db, you could pretty easily find
orphaned data, couldn't you?

-Tom.
>>Hello all,

Prior to going live with my app, I have questions on relationships theory.

My prior app was done in Access 97, and I did NOT use relationships at
all.
I have 65 tables in my back-end database, and with Access 97, if you added
relationships, it would add multiple copies of the same relationships over
and over, so I decided not to use any relationships at all.

Additionally, when I needed to add or remove fields via code, it was a lot
easier without relationships, as you didn't need to worry about adding
relationships when adding new fields, or removing them if you needed to
delete an obsolete field.

So the question is, I'm about to deploy the app, re-worked in in Access
2007, and with the 65 tables, The relationships screen in the back-end
database is very full. I would think that so many relationships would
actually slow the database down, and would make table maintenance much
more
difficult in the future.

Can anyone give me their opinions, pros and cons, on whether to have
relationships or not?

Many thanks,

Aug 20 '07 #3
On Mon, 20 Aug 2007 13:49:06 GMT, "ARC" <an**@andyc.comwrote:

Absolutely. That's what I was assuming. Without checking the box to
enforce RI, you've only added some pretty lines that may be helpful
with query design.

-Tom.

>I just added the relationships in 2007, I didn't set any referential
integrities.

You're right about my 97 app. For example, when they wanted to delete a
customer, I ran code that would delete records in other tables, such as a
letters table, quotes, quote details, etc., and I would sometimes deleting
from a table.

So by orphaned data, do you mean to make sure I use the options to maintain
referential integrity?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:ue********************************@4ax.com.. .
>On Mon, 20 Aug 2007 13:27:55 GMT, "ARC" <an**@andyc.comwrote:

Yes, such a db would be slower (there are additional indexes and
checks to be made), but the difference is not noticible and the effect
is negligible compared to the ENORMOUS benefit of data integrity.

I'm sure if you went back to your A97 db, you could pretty easily find
orphaned data, couldn't you?

-Tom.
>>>Hello all,

Prior to going live with my app, I have questions on relationships theory.

My prior app was done in Access 97, and I did NOT use relationships at
all.
I have 65 tables in my back-end database, and with Access 97, if you added
relationships, it would add multiple copies of the same relationships over
and over, so I decided not to use any relationships at all.

Additionally, when I needed to add or remove fields via code, it was a lot
easier without relationships, as you didn't need to worry about adding
relationships when adding new fields, or removing them if you needed to
delete an obsolete field.

So the question is, I'm about to deploy the app, re-worked in in Access
2007, and with the 65 tables, The relationships screen in the back-end
database is very full. I would think that so many relationships would
actually slow the database down, and would make table maintenance much
more
difficult in the future.

Can anyone give me their opinions, pros and cons, on whether to have
relationships or not?

Many thanks,
Aug 20 '07 #4
ARC
This may take some doing with 65 tables. I've never used the Ref. integrity
before, so it looks like I'll have to examine each relationship (and it's
already hard to look at the relationships screen with all the objects it
contains).

For example, if you have the following:

Parts table, PartID

PartID is also contained in:

InvoiceDetail, QuoteDetail, Inventory, PartSpecs, PartNotes, JobPartsUsed,
BillingMonthlyCharges, BillingMChargesTemplate, RMADetail.

Currently, however, I wouldn't let them delete a part that is in use in any
of the above tables. For example, if they wanted to remove a part contained
on quotes, and all the quotes it appeared in, I would have to write code to
recalculate all the quotes, so I just prevent them from deleting.

I have lots of code like this. Another example, I won't let them delete a
customer if the custID is in use in invoices, quotes, jobs, etc.

Any strategies you can offer for going through them?
Thanks for the replies!

"Tom van Stiphout" <no*************@cox.netwrote in message
news:d2********************************@4ax.com...
On Mon, 20 Aug 2007 13:49:06 GMT, "ARC" <an**@andyc.comwrote:

Absolutely. That's what I was assuming. Without checking the box to
enforce RI, you've only added some pretty lines that may be helpful
with query design.

-Tom.

>>I just added the relationships in 2007, I didn't set any referential
integrities.

You're right about my 97 app. For example, when they wanted to delete a
customer, I ran code that would delete records in other tables, such as a
letters table, quotes, quote details, etc., and I would sometimes deleting
from a table.

So by orphaned data, do you mean to make sure I use the options to
maintain
referential integrity?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:ue********************************@4ax.com. ..
>>On Mon, 20 Aug 2007 13:27:55 GMT, "ARC" <an**@andyc.comwrote:

Yes, such a db would be slower (there are additional indexes and
checks to be made), but the difference is not noticible and the effect
is negligible compared to the ENORMOUS benefit of data integrity.

I'm sure if you went back to your A97 db, you could pretty easily find
orphaned data, couldn't you?

-Tom.

Hello all,

Prior to going live with my app, I have questions on relationships
theory.

My prior app was done in Access 97, and I did NOT use relationships at
all.
I have 65 tables in my back-end database, and with Access 97, if you
added
relationships, it would add multiple copies of the same relationships
over
and over, so I decided not to use any relationships at all.

Additionally, when I needed to add or remove fields via code, it was a
lot
easier without relationships, as you didn't need to worry about adding
relationships when adding new fields, or removing them if you needed to
delete an obsolete field.

So the question is, I'm about to deploy the app, re-worked in in Access
2007, and with the 65 tables, The relationships screen in the back-end
database is very full. I would think that so many relationships would
actually slow the database down, and would make table maintenance much
more
difficult in the future.

Can anyone give me their opinions, pros and cons, on whether to have
relationships or not?

Many thanks,

Aug 20 '07 #5
On Mon, 20 Aug 2007 22:45:29 -0500, "ARC" <an**@andyc.comwrote:

No, the relationships are only deleted if you delete the lines between
the tables, not if you remove a table from the view (by "deleting"
it).

-Tom.

>If you delete all tables from the relationship view, won't it delete the
relationship? I like your idea of paring down the view of tables, thanks for
that.
<clip>

Aug 21 '07 #6
ARC
Tom and Albert,

Many thanks again. And Tom, your idea of searching the tabledefs is working
perfectly. I missed PartID in 2 tables. Actually, clicking the RE to enforce
is helping me see what I need to code for in my upgrade routine. I've found
a couple cases where the partID was no longer there, and a couple where
PartID = 0.

Also, for anyone in the same boat, and can't find the code, I came up with a
quick routine where you pass the search text, such as PartID, and then view
the results:

Public Function FindTextGlobal(searchtxt As String)
On Error Resume Next
Dim fld As Field, mydb As Database, SaveYN As Integer, i As Integer, DelText
As Integer, FName As String, cntrl As String, searchin As String, db As
Database, mytable As TableDef, r As Report, f As Form, ctrl As Control
SaveYN = acSaveNo
Set mydb = DBEngine.Workspaces(0).Databases(0)
For i = 0 To mydb.TableDefs.Count - 1
Set mytable = mydb.TableDefs(i)
For Each fld In mytable.Fields
If fld.Name = searchtxt Then
Debug.Print "Field: " & searchtxt & " found in table: " &
mytable.Name
End If
Next fld
Next i
mydb.Close
db.Close
End Function
Aug 21 '07 #7
ARC
Ok, couple of bad designs, although my intentions were good: To have less
objects.

I have about 3 multi-use tables:

Addresses:

This stores additional addresses for both Customers and Suppliers. To make
it multi-user, I have 2 fields: CustSupplierID and CustYN. So if CustYN is
set to yes, then the CustSupplierID holds the CustID. Otherwise, if CustYN
is no, CustSupplierID is the SupplierID.

Same goes for a table: tLetters. It has the same CustVendID and CustYN, with
the same logic.

Finally, I have a table called SerialNos that is multi-use in the respect
that it holds partID's and serial numbers for tracking serial numbers on
both the Purchase side and Invoices (Sales) side. I allow the tracking of
serial numbers that are taken in on a purchase, and when the item is sold on
an invoice, I create another entry in SerialNos that adds in the invoice.
Unlike the other 2 tables, however, there are no multi-use fields. I have
both an InvoiceNo field and a PurchaseNo field, each storing the primary
keys of the invoices and purchase tables. In hindsight, I should have been
updating the original purchase and using only one entry for BOTH the
InvoiceNo and PurchaseID. However, I have one record for the purchase, and
one for the Invoice. This design happened because purchases was not part of
my original design, and additionally user's can choose not to use the
purchase screen at all, and simply track serial nos on the invoice side
only.

So that's it, the question is what to do with RE and relationships for the
above 3.

Thanks!

Andy


Aug 21 '07 #8
"Albert D. Kallal" <Pl*******************@msn.comwrote in
news:ATUyi.81811$rX4.63798@pd7urf2no:
I can't recall the last time I used cascade updates. It means in
the effect your change the key value used in a relationships. I
suppose if you were to move a incorrect invoice "details" from one
customer to another, you might use cascade updates, but even that
is rare.
I can't see how that would involve a cascade update. If you moved
the invoice to a different customer, you'd update the CustomerID FK
value in the invoice, but that would have no effect on the invoice
items, so there's no update to cascade. If you moved the invoice
items to a different invoice, you'd update the InvoiceID FK in the
invoice items table, but there's nothing to cascade there, either.

So, when you are using surrogate keys, there is never any need for
CASCADE UPDATE -- it is only needed when the parent value could be
edited.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 23 '07 #9
"ARC" <an**@andyc.comwrote in
news:mI**************@nlpi061.nbdc.sbc.com:
The more I think of it, the more it sounds like I only want to use
cascade deletes on customers. But must first check that invoices
are not present for a customer, and not allow deletion if they
are. If there are no invoices, I don't mind if they want to delete
everything associated with a CustID: Customer rec, Letters
records, Quotes, Quote Detail, and the like.
In that case, have CASCADE DELETE turned ON for all those tables,
and OFF for the INVOICES. That's the standard structure in all the
billing apps I've built -- anyone with $$$ transaction history can't
be deleted.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 23 '07 #10
"ARC" <an**@andyc.comwrote:
>You're right about my 97 app. For example, when they wanted to delete a
customer, I ran code that would delete records in other tables, such as a
letters table, quotes, quote details, etc., and I would sometimes deleting
from a table.
Now I'd never do that. History can be useful. I'd have an inactive or a status flag
and move that customer to the bottom of various forms and combo boxes. But that
customer would still be available for inquiry purposes.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 25 '07 #11
"ARC" <an**@andyc.comwrote:
>- When to check the cascade updates and cascade deletes.
I never, ever use them.

I have an intense dislike for cascade deletes in Microsoft Access. And I don't like
cascade updates.
http://www.granite.ab.ca/access/cascadeupdatedelete.htm
>For example, if I
have a parts table, quotesDetail and InvoicesDetail table, that both contain
the partID, if a part is deleted, naturally I would want the data deleted
out of quotes and invoices detail,
Never, ok, very, very seldom, delete data. Now your historical reports will be
wrong. Inactivate the part and put it at the bottom of forms and combo boxes but
never delete it.
>- Note quite sure where / when you would use a cascade update.
If you use an autonumber primary key then never.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 25 '07 #12
ARC
Hi Tony,

I should have said that I already had code in place for NEVER allowing
deletes of invoice data when payments were present. I allow an invoice
delete Only in the even that they created the invoice by mistake, but if
payments exist, I don't allow it.

I'm going to create a new post on RE and cascade deletes, because I've found
a good case for using them.

As always, Thanks for your reply! Always appreciated.

Andy
"Tony Toews [MVP]" <tt****@telusplanet.netwrote in message
news:p7********************************@4ax.com...
"ARC" <an**@andyc.comwrote:
>>- When to check the cascade updates and cascade deletes.

I never, ever use them.

I have an intense dislike for cascade deletes in Microsoft Access. And I
don't like
cascade updates.
http://www.granite.ab.ca/access/cascadeupdatedelete.htm
>>For example, if I
have a parts table, quotesDetail and InvoicesDetail table, that both
contain
the partID, if a part is deleted, naturally I would want the data deleted
out of quotes and invoices detail,

Never, ok, very, very seldom, delete data. Now your historical reports
will be
wrong. Inactivate the part and put it at the bottom of forms and combo
boxes but
never delete it.
>>- Note quite sure where / when you would use a cascade update.

If you use an autonumber primary key then never.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

Aug 28 '07 #13
"ARC" <an**@andyc.comwrote:
>I should have said that I already had code in place for NEVER allowing
deletes of invoice data when payments were present. I allow an invoice
delete Only in the even that they created the invoice by mistake, but if
payments exist, I don't allow it.
That's almost a good reason. <smile But even then I'd inactivate the invoice.
After all you've consumed the invoice number and auditors don't like missing invoice
numbers.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 28 '07 #14

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

Similar topics

0
1724
by: Dave Roe | last post by:
This is more of a general SQL relationship question than a PostgreSQL-specific question, although I am using PostgreSQL to implement this. I have a number of data structures which I am calling...
9
3412
by: (Pete Cresswell) | last post by:
Seems like when there's a 1:1 relationship, the order of referential integrity enforcement depends on which way you drag the mouse pointer when drawing the relationship line. If you drag from...
49
2198
by: Mal | last post by:
Hi, As I gain knowledge through a lot of trial, error, and usenet posts.. I have a potentially odd question. I am using a commercial access application. It is a front-end / back...
2
4115
by: Max | last post by:
Hi. I really hope someone can help me. Going slowly insane with this problem. I have a two Access 2000 databases. One is the backend containing tables and some admin queries. The other is the...
7
2112
by: davegb | last post by:
I'm totally new to relational database design. My boss has asked me to create a database of information on the employees in our group. Seemed to me like a simple application to learn the ropes. A...
45
3350
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...
1
1656
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...
1
2459
desklamp
by: desklamp | last post by:
Access 2003 on Win2K The tables involved: an IP address table, tblIP, where basic IP address information is stored: IP, WHOIS, reverse DNS name, etc. an event IP table, tblIPEvent, where...
8
1678
by: Phil Stanton | last post by:
I have a FE, BE database on my home computer and a duplicate on the office computer. Both use Ak2 on Windows XP. The one at home appears normal. The BE consists of about 50 tables with numerous...
0
7223
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
7321
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,...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
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
5623
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
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.