Create Unique Product within a table based on mutliple inputs from other tables (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 10:04
Joined
Dec 1, 2014
Messages
401
Hi.

I am trying to create a table that allows me to create a product description that is unique.

To elaborate i have three table - Tbl_Category, Tbl_Potsize and Tbl_CaneType. Within category i have things like fruit, clematis, fuchsia (types of plants basically). Within potsize i have the various pot sizes a plant can be grown (9cm, 2L , 3L) and within canetype i have bamboo 90cm, bamboo 60cm etc. The idea is that a product type would be made - for example I could have a 2L-Fruit_90cm_bamboo_cane or a 2LClematis_90cm_bamboo_cane.

What i want to ascertain is how do i create a table that will not allow me to create the same product type of three elements combined. SO could put in 2L fruit 90cm and 2l fruit 60cm cane but couldnt double put in 2L fruit 90cm twice.

Hope that makes sense.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:04
Joined
Oct 29, 2018
Messages
21,467
Hi. Try to look up "multi-field unique index" or "multi-column unique index."
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:04
Joined
Sep 21, 2011
Messages
14,260
I would have a table that holds the PK of each and make a unique index of all three keys.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:04
Joined
May 7, 2009
Messages
19,230
you may also need to add validation before the record is saved.
if you are inputting direct to the table, use BeforeChange DataMacro.

if on form check if all fields are filled and then use DCount() to validate
if the new record has same "description" on your table.
 

Users who are viewing this thread

Top Bottom