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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get sum of field from one table and update another

Status
Not open for further replies.

FurryGorilla

Technical User
Apr 11, 2001
76
GB
I have 2 tables, one named tblOee and the other named tblUnder60 I need to run a query which will create records in tblUnder60 based on a week number from a form, created from all of the records in tblOee

tblUnder60 has one record per machine and needs to be updated with the total times (using sum) for that machine for the specified week.

The fields in the tbleUnder60 table are:
Code:
week, machine, time, planned, unplanned

I can create the records when only week, machine and time are input.

Unfortunately the planned and unplanned are totalled from the tblOee which is linked to another table named tblActivity by way of
Code:
activity
. The tblActivity
Code:
activity
corresponds to a
Code:
value
b
. For example if an employee enters a a record with an activity code which has a letter b associated with it, then this is a planned record and so needs to be totalled with all other similar activities and inserted into the tblUnder60 table.

I have the initial append query which adds records for individual machines to tblUnder60 but I'm not sure of the syntax for an Update query where the machineno and weekno are matched.

Any help would be greatly appreciated as the employee who created this has now left and, being on an industrial placement, I have been dumped with it :)

Many thanks
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top