Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I populate subform based on main form and query on subform

Status
Not open for further replies.

planetdrouin

Technical User
Dec 29, 2001
36
US
I have a form which creates Invoices. First the user selects a ClientID on the main form, which then refreshes data in the subform. This part works fine. What I want is for the subform to list out all the Employees names and amount of unbilled time for that client.

What I currently have is a combo box on the subform which lists the employees that meet the main form's criteria. However, the user has to select each name from the combo box individually which then populates the other control boxes on the subform. What I would like is the subform to automatically list out all those that meet the criteria.

The main form has for record source "tblInvoice", while the subform has "tblTimeInvoiced". On the other hand, the combo box on the subform uses a query to filter the EmployeeIDs that meet the criteria of the main form input.

The query is as follows:

SELECT TblTimeDetail.EmployeeID, Sum([TimeFee]-[InvoicedTime]) AS TimeLeft FROM TblTimeDetail INNER JOIN TblEmployees ON TblTimeDetail.EmployeeID=TblEmployees.EmployeeID GROUP BY TblTimeDetail.EmployeeID, TblTimeDetail.ClientID HAVING (((Sum([TimeFee]-[InvoicedTime]))<>0) And ((TblTimeDetail.ClientID)=forms!frmInvoice.[ClientID]));

TblTimeDetail are the time cards.

Can anyone suggest a solution or a better way of doing this.

Thanks

Lawrence
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top