A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Table validation rule - allow only one occurence in a field



 
 
Thread Tools Display Modes
  #1  
Old October 23rd, 2009, 06:56 PM posted to microsoft.public.access.tablesdbdesign
jaworski_m
external usenet poster
 
Posts: 28
Default Table validation rule - allow only one occurence in a field

Hello,
Suppose there's a table (many side):

ID (PK)
ID_foreign (FK)
field 1
field 2
yes/no field

How can I allow ONLY ONE record to have "yes/no field" = True? (with table
validation rule)
In case a user sets a second record "yes/no field" = True an error is
triggered.

Thank you for suggestions.

Access 2003
  #2  
Old October 23rd, 2009, 11:48 PM posted to microsoft.public.access.tablesdbdesign
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Table validation rule - allow only one occurence in a field

jaworski_m wrote:
Hello,
Suppose there's a table (many side):

ID (PK)
ID_foreign (FK)
field 1
field 2
yes/no field

How can I allow ONLY ONE record to have "yes/no field" = True? (with table
validation rule)
In case a user sets a second record "yes/no field" = True an error is
triggered.

What happens when you add a unique index (no duplicates) to the yes/no field?
Thank you for suggestions.

Access 2003


--
Message posted via http://www.accessmonster.com

  #3  
Old October 23rd, 2009, 11:49 PM posted to microsoft.public.access.tablesdbdesign
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Table validation rule - allow only one occurence in a field

jaworski_m wrote:
Hello,
Suppose there's a table (many side):

ID (PK)
ID_foreign (FK)
field 1
field 2
yes/no field

How can I allow ONLY ONE record to have "yes/no field" = True? (with table
validation rule)
In case a user sets a second record "yes/no field" = True an error is
triggered.

What happens when you add a unique index (no duplicates) to the yes/no field?
You do realize that with this rule enforced at table level, you can only have
two records in your table, right? (one Yes and one No).
Thank you for suggestions.

Access 2003


--
Message posted via http://www.accessmonster.com

  #4  
Old October 24th, 2009, 03:46 PM posted to microsoft.public.access.tablesdbdesign
jaworski_m
external usenet poster
 
Posts: 28
Default Table validation rule - allow only one occurence in a field

You do realize that with this rule enforced at table level, you can only have
two records in your table, right? (one Yes and one No).


Yes, correct. But I would like to have Many records (not only 2) and only
ONE with value "Yes".



"PieterLinden via AccessMonster.com" wrote:

jaworski_m wrote:
Hello,
Suppose there's a table (many side):

ID (PK)
ID_foreign (FK)
field 1
field 2
yes/no field

How can I allow ONLY ONE record to have "yes/no field" = True? (with table
validation rule)
In case a user sets a second record "yes/no field" = True an error is
triggered.

What happens when you add a unique index (no duplicates) to the yes/no field?
You do realize that with this rule enforced at table level, you can only have
two records in your table, right? (one Yes and one No).
Thank you for suggestions.

Access 2003


--
Message posted via http://www.accessmonster.com

.

  #5  
Old October 26th, 2009, 05:40 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Table validation rule - allow only one occurence in a field

I do not hink you can do it in a table but in a form.

If DSum 0 then message and not allow change of checkbox.

--
Build a little, test a little.


"jaworski_m" wrote:

You do realize that with this rule enforced at table level, you can only have
two records in your table, right? (one Yes and one No).


Yes, correct. But I would like to have Many records (not only 2) and only
ONE with value "Yes".



"PieterLinden via AccessMonster.com" wrote:

jaworski_m wrote:
Hello,
Suppose there's a table (many side):

ID (PK)
ID_foreign (FK)
field 1
field 2
yes/no field

How can I allow ONLY ONE record to have "yes/no field" = True? (with table
validation rule)
In case a user sets a second record "yes/no field" = True an error is
triggered.

What happens when you add a unique index (no duplicates) to the yes/no field?
You do realize that with this rule enforced at table level, you can only have
two records in your table, right? (one Yes and one No).
Thank you for suggestions.

Access 2003


--
Message posted via http://www.accessmonster.com

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.