Newbie - help with validation rules

S

Spidey3721

Hello - newbie here.

I have two tables - One that is a master category list for cost codes
(example: CodeID=0002 CodeDescr=Drywall subcontract)

My second table is for each project, where I would like to be able to enter
in a specific cost amount for each cost code (example CostID=1, CodeID=0002,
Cost=$415,000).

I am stuck trying to limit the user from only entering one cost for each
cost code that exists in the master list.
 
J

John Vinson

Hello - newbie here.

I have two tables - One that is a master category list for cost codes
(example: CodeID=0002 CodeDescr=Drywall subcontract)

My second table is for each project, where I would like to be able to enter
in a specific cost amount for each cost code (example CostID=1, CodeID=0002,
Cost=$415,000).

I am stuck trying to limit the user from only entering one cost for each
cost code that exists in the master list.

Open the Relationships window and create a relationship between the
two tables joining them on CodeID, and check the "Enforce Relational
Integrity" checkbox. If you want one and only one cost for each
CodeID, you can make the CostID field unique by setting a unique Index
on it - but you might instead just do away with this second table
altogether, and simply put CostID into the master list as a foreign
key.
 
S

Spidey3721

Actually - I want only one cost aloowed for each category PER PROJECT. This
might change things up a bit.


I have two tables - One that is a master category list for cost codes
(example: CodeID=0002 CodeDescr=Drywall subcontract)

My second table is for each project, where I would like to be able to enter
in a specific cost amount for each cost code (example ProjectID=256724
(foreign key to master job table), CostID=1, CodeID=0002,
Cost=$415,000).
 
J

John Vinson

Actually - I want only one cost aloowed for each category PER PROJECT. This
might change things up a bit.


I have two tables - One that is a master category list for cost codes
(example: CodeID=0002 CodeDescr=Drywall subcontract)

My second table is for each project, where I would like to be able to enter
in a specific cost amount for each cost code (example ProjectID=256724
(foreign key to master job table), CostID=1, CodeID=0002,
Cost=$415,000).

It sounds like you could make CostID and ProjectID a joint Primary Key
of this table, or else create a unique Index on these two fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top