Update Query

C

Clint

I am trying to update a feild in a table with the sum of
data from another. I had the expression, but accidentally
deleted it. Specifically, I am trying to total training
hours by employee from one table and update each person's
total training hours in another table.
 
J

John Spencer (MVP)

You really don't need to store the total training hours as it could (and should)
always be calculated.

But if you feel you MUST do this you will probably need to use the DSum function.

UPDATE SomeTable
Set SomeTable.SomeTotalField =
DSUM("TrainingTime","TrainingTable",
"EmployeeId=""" & SomeTable.EmployeeID & """")

This assumes that EmployeeId is a text field. If it is numeric then drop the
extra quotes.
 

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