Thanks for the reply it is working :)
What I need to do now is to show total field on the form based on a query where there are 7 different rows [employeeID] and I need to extract the total of the employeeID which is choosen from the combo box on the form.
Any ideas how to do it?
Thanks in Advance
Again, I am using DLookup rather than DSum because, if I understand you correctly, your query has the total for each employeeID, hence you just need to look up that total. You would use DSum if the query has several entries for each employeeID that have to be totaled.
try this if EmployeeID is a numeric data type in your table.
YourTextbox2 = DLookup("[TotalHours]" , "YourQuery", "[EmployeeID] = " & Me!YourCombo)
try this if EmployeeID is a text data type in your table.
YourTextbox2 = DLookup("[TotalHours]" , "YourQuery", "[EmployeeID] = '" & Me!YourCombo & "'")