Query on current record

FlashG

Registered User.
Local time
Today, 08:21
Joined
Dec 6, 2001
Messages
18
I have a form Tasks and a second form Parts which is also imbeded in the Task for as a subform. On the Task form I have a TaskID field, AdminHours field and a TotalTaskHours field. On the Parts form I have a TaskID (1 task, many parts) and a PartHours field. The TotalTaskHours field is a calculated field of the AdminHours and the sum of the PartHours from each part associated with the current task (each has the same TaskID as the current record in the Task form)

I am wondering how I calculate this value. I tried to create a query that filtered out the parts needed then a SetValue macro to
[Tasks]![AdminHours]+Sum([PartsQuery]![PartHours]) but this doesnt' seem to work. Anyone have any ideas?
 
Have you tried the Totals line in the Query Design view? It's under View>Totals or click on the sigma button (looks like a greek E). Look for the MS Access help on 'calculate total'.

HTH,
David R
 
Ok, I'm still new and clueless here but, I think I got the query right. I redid it and used the totals button. Now how do I apply that to the field on my form (and add it to the other AdminHours field for that matter)

I appreciate the help
 
I believe if you view your query it will have new fields in it, like Sum of fieldfromTableX. You can rename these for sanity's sake like any other query field (NewName: Expression in the top line of Query Design View. You should be able to use those new fields as the bound source for the fields on your form. If your form must come from a different source, lookup the Dlookup function.

HTH,
David R
 

Users who are viewing this thread

Back
Top Bottom