Updating data in a table using a query

  • Thread starter Thread starter red6000
  • Start date Start date
R

red6000

Hi,

I have a table of data and run a query (see below). What I would like to do
is amend the results in the query data view so that the main table is
updated. Is this possible, if so can you point me in the right direction?
I had looked at using an 'Update' query, but that doesn't appear to be what
i'm after.

Thanks.

SELECT Activities.TaskName, DSum("TimeSpent","Activities","TaskName = '" &
[TaskName] & "'") AS TotalTime
FROM Activities
WHERE (((Activities.WorkDate)=Forms!InputForm2!MainTimesheet.Form!WorkDate)
And ((Activities.CSTRName)=Forms!InputForm2!MainTimesheet.Form!EmployeeID))
GROUP BY Activities.TaskName, Activities.WorkDate
ORDER BY Val(DSum("TimeSpent","Activities","TaskName = '" & [TaskName] &
"'")) DESC;
 
If you want to update data in a Table using a Query, an UPDATE query is the
one you need.

However, it may not be a simple process converting from your posted SQL
(which is a Total Query using GROUP BY) to an UPDATE Query depending on
which Field you want to update with which value.

You need to describe your Table details and which Field / which value to use
in the update so that others can suggest a solution. Perhaps a small sample
dataset and the result of the update for the sample dataset would help also.
 
Back
Top