Selasa, 12 Juli 2016

Re: [MS_AccessPros] Relationship Definition

 

Sarah-


Allow Zero Length may let the user store a "blank" instead of a Null when no value is entered.  That was the problem.  RI ignores Null values, but a "blank" won't match anything in the other table, so you get an error.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 12, 2016, at 9:37 PM, sarahk@schemesoftware.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:




Thanks John,
I changed the zero length property and ran the query and now I can enforce the integrity.

I dont understand the zero length property:if the field is not filled in , then what is stored in the table if allow zero length is yes? If allow zero length is no?.

Sarah

---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Sarah-

Make sure the Allow Zero Length property of the field is set to NO.  That alone may fix the problem.  Or you might need to run a query:

UPDATE Products
SET [Product Class] = Null
WHERE Len([Product Class]) = 0;

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 12, 2016, at 9:07 PM, sarahk@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:





The data type of the Product Class is text. How to I check if it is a true Null value?. How do I set it to Null if it's not filled in on the data entry form?.
Sarah
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Sarah-

What is the data type of Product Class?  As long as the field in the Product table contains a true Null value, you should be able to define the rule.  I suspect you have some non-Null or other invalid values.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 12, 2016, at 7:46 PM, sarahk@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I have 2 tables:

Product Class

Product


The Product table has a field Product Class that relates to the Product Class table. This field in the Product table is optional.

 I am trying to define a Relationship with 'referential integrity' between the Product Class and the Product table, but because I have records in the Product table that dont have the Class filled in, I am getting a message 'Product violates referential integrity'. Is there any way around this?. I have tried all Join Types but I am getting the same message on all of them. 


Thanks for your answers.


Sarah










__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar