Problem with check constraint (1 Viewer)

Chunk

Registered User.
Local time
Today, 04:32
Joined
Oct 25, 2004
Messages
64
I have a table with the following fields:

format
region
rarity

they are all set to lookup value lists:

format: tape; dvd
region: 0;1;2;3;4;5;6;7;8;pal;ntsc
rarity: 1;2;3;4;5

I have a check that makes sure (format, rarity, region) is unique.

It works fine until i set region to either "pal" or "ntsc", then I get the following error.

"Error 'Error evaluating CHECK constraint. ' in the validation rule."

I set up the constraint by going to table design view -> indexes -> created new index with each of the three fields listed one after another -> set to primary=no, unique=yes, ignore nulls=no.

Can anyone help me work out why im getting this problem?
 

neileg

AWF VIP
Local time
Today, 04:32
Joined
Dec 4, 2002
Messages
5,975
It could be a datatype problem. 0-9 are clearly numbers and 'pal' and 'ntsc' are text. What data type is your region field?

Mind, you, since the combination of 'tape' and a region number is invalid, I would have set it us a different way. Create a table with an autonumber PK, a field for tape or dvd and a field for region. Populate this table with the valid combinations, there's only 12 possible, and let the user select the valid one from a combo box. Store the ID in your main table .
 

Chunk

Registered User.
Local time
Today, 04:32
Joined
Oct 25, 2004
Messages
64
The data type is text, its too late to change the way it is set up.
 

neileg

AWF VIP
Local time
Today, 04:32
Joined
Dec 4, 2002
Messages
5,975
I've set up a table exactly as you describe and it works fine for me (even if I don't like the design!). Sorry I can't explain why yours doesn't work
 

Attachments

  • db1.zip
    7.4 KB · Views: 244

Users who are viewing this thread

Top Bottom