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!

Validation Rule Involving Sum & Group By?

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
I have a table which is going to store information about species for a particular area, & relative abundance.

The fields are:

AreaID, SpeciesID, RelAbundance.

For any given AreaID I need to create a validation rule to ensure the Sum(RelAbundance) <= 100

Any ideas?

James Goodman MCSE, MCDBA
 
Create your Totals query that does the summations and GroupsBy the AreaID and SpeciesID. Then create a Select query that adds your Table and the Totals query. Join the AreaID and SpeciesID fields. Add the fields you need and then use this query as the Record Source for a Form. You can then use the Validation Rule property on the SumOfRelAbundance control to test for values <= 100.

Paul
 
Unfortunately I cannot use a query because the program which will be inserting the data is now aware of queries (ArcGIS). I therefore need to validate at the table level.

I think it might support a vba function, although I am not sure how to handle the returned value at this stage. I will look into it...

James Goodman MCSE, MCDBA
 
Well, you could create a separate table that has the three fields, then create your totals query, then create an update query that would update the values from your Totals query to the fields in your Table. That might work.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top