?
Solved

Could you point how to deal with this intricated Relational Integrity when using MS-Access ?

Posted on 2016-08-23
16
Medium Priority
?
44 Views
Last Modified: 2016-08-24
Hi Experts

Could you point how to deal with this intricated Relational Integrity when using MS-Access ?

Accordingly to
 img001
Three columns of tblBooks must have relational integrity with tblAutores at same time, but just one (AutorEncarnadoIndex)  or two(AutorEspiritualIndex and AutorEncarnadoIndex) must be filled at same time.

If only one of  the 03 columns has "0" value the a insertion could not be performed.

If the relational integrity isn't flagged  to all the 03 columns an author that is still been used in a not relationed column, it can be deleted.

Any suggestion?

Thanks in advance.
0
Comment
Question by:Eduardo Fuerte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
16 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41767736
From what I can understand, you need RI to the three columns in tblBook. Each Author index need to related to the Author index - correct?

In that case you must create three separate RI relationships. So you add the Author table three times and create a relationship to each of the three Author columns in your tblBooks.


Kelvin
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41767741
In addition to my post above, you should not use a default of 0 for no value. RI accepts the use of NULL for columns with no value. 0 Implies that it is a value - which in this case it technically incorrect.


Kelvin
0
 

Author Comment

by:Eduardo Fuerte
ID: 41767850
Hi


So I put 03 copies of tblAutores, each one with a RI to one of the tblBooks columns.
Accordingly to:

img002
And changed the default values to null for the 03 columns in tblBooks.

If all the three columns in tblBooks are filled, Ok.

But if I fill just one column, the error arises (using C#).

img003
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:Eduardo Fuerte
ID: 41767856
Exception translated:

It's not possible to add ou modify register, since it's necessary it have a register related in tblAutores
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41767869
Are you able to edit the row directly in Access? Are you running some sort of data layer between Access and C# (Entity Framework or similar)?


Kelvin
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41767873
Can you also open tblBooks in design and check that the three Index values do not have required set to Yes.


Kelvin
0
 

Author Comment

by:Eduardo Fuerte
ID: 41768563
Hi


I'm using C# with OleDb - not using data layer.

I can edit the lines directly inside Access.

(The Access MDB file  is attached here, in case you want to have a look)
MasterFile.mdb
0
 

Author Comment

by:Eduardo Fuerte
ID: 41768566
... and the columns have the required clause set to no.
0
 

Author Comment

by:Eduardo Fuerte
ID: 41768581
and just in case, RI is fired when editing the line directly inside Acceess

(better MDB file)
MasterFile.mdb
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41769203
If you can edit the records directly in the database exactly as you try via your application, then I believe that the problem lies in your application and not the database. I am not a C# developer, so have a limited ability to assist you here.


Kelvin
0
 

Author Comment

by:Eduardo Fuerte
ID: 41769227
@Kelvin

If I edit the line record directly in MS-Access the same error arises, so the problem isn't related to C# itself.
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41769269
Ah, OK I'll check out your db shortly and advise
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41769287
Database password?
0
 

Author Comment

by:Eduardo Fuerte
ID: 41769299
Sorry

lib2006
0
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 2000 total points
ID: 41769320
OK, have edited the database. I removed all DEfault values from the fields in question - just leave blank for NULL. I have also edited the relationships diagram to remove duplicate relationships to these.
MasterFile.mdb
0
 

Author Closing Comment

by:Eduardo Fuerte
ID: 41769412
Perfect!

Thank you very much.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question