Show sum based on selection from Combo Box - Help Please

T

tmdrake

I have a form, on the form there are 4 combo boxes for selection and the
result are showed in a subform. I created a table (tblHours_worked) that
contain the number of hours worked by each in employee. Now based on the
selection from the combo box(s) how do I get the total hours worked to
calculate and show in a field on the main form? Hopefully, this makes sense.
 
N

n00b

Add the textbox to the main form, I'm going to call it txtHourSum.
For the control source for the txtHourSum put in something like this:

=DSum("WorkHours","tblHours_worked", "Employee = " & Me.Employee)

Of course, your criteria should match the selection criteria of your
subform. Everytime you change the criteria, you will need to requery
the textbox:

txtHourSum.Requery
 
?

.

dans l'article (e-mail address removed), tmdrake à
(e-mail address removed) a écrit le 23/01/08 18:06 :
 
T

tmdrake

I am getting an #Name? error. Not sure why. Does the combo boxes have to
have the same table (tblHours_worked) as their control source. Right now I
have:

Combo box 1 = ProjectID - row source = qryProjectID
Combo Box 2 = Discipline Name - row source = qryDisciplineName
Combo Box 3 = Section Number - row source = qrySectionNumber
Combo Box 4 = Last Name - row source = qryLastName

The field to calculate on tblHours_Worked is titled PHW (Project Hours
Worked).

The record source for the Main form and subform is tblProject Staffing
Resources.

Hopefully, this additional information will help.

Thanks
tmdrake
 

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