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!

Very new, need to sum certain fields

Status
Not open for further replies.

gr8whitewaldron

Technical User
Aug 6, 2003
25
US
Hi, I am very new at this and need some help.
I have a field of start date, end date, and value, and then a test date and total. If the test date falls in between the start and finish, it adds its value to the total. I really have no experience with macros or modules so exactly how would I go about making this work?
Thanks in advance.
 
It's a bad idea to include a totals field in the table. At some point it will be out of sync with the other fields. A better idea is to calculate and display the totals whereever you may need them; in a form or a report.

Having said that, here's a simple way to update the Total field using an update query.

UPDATE TableName SET [Total] = [Total] + [Test Date]
WHERE [Test Date] between [Start Date] And [End Date];

Substitute the name of your table for TableName.
 
Thanks, I think from there I can figure out how to add three or more values between dates, unless you have a two line solution to that too. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top