Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a trigger or contraint in MS Access?

Status
Not open for further replies.

ivanteh

Technical User
Aug 2, 2000
2
SG
Hi All,
How do I add a trigger or any other mechanism to do the following task?
I have a table, say PercentageByCountry.
Sample data in table PercentageByCountry:

ID Country Revenue Percentage(%)
----------------------------------------------
1 United States 30000 30%
2 United States 50000 50%
3 United States 20000 20%
4 Germany 6000 60%
5 Germany 4000 40%

My question is: how can I place a constraint/ trigger, or any other mechanism to ensure that the total percentage for each group (Country) would add up to 100%? Eg: U.S -> 30%+50%+20% = 100%. Germany -> 60%+40% = 100%.
If the user keys in a combination that does not equal to 100%, then I'd like a prompter or warning.
Please help, as I'm not that familiar with MS Access.
Any pointers and sample would be much appreciated.
Thanks in advance.
 
Access does not support Triggers. You can trap for this in the forms before update event which will allow testing of these conditions before the data hits your table.

If you are hoping to do this directly at the table level, you cannot. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top