Create this query in your database and name it Qry_CurrentInvoice:
Code:
SELECT Sum([Time Card Hours].BillableHours) AS BilledHours, Sum([billablehours]*[billingrate]) AS BillAmt
FROM [Time Card Hours]
GROUP BY [Time Card Hours].DateWorked, [Time Card Hours].ProjectID
HAVING ((([Time Card Hours].DateWorked)>=[forms]![Print Invoice]![Begin Date] And ([Time Card Hours].DateWorked)<=[forms]![Print Invoice]![End Date]) AND (([Time Card Hours].ProjectID)=[forms]![Print Invoice]![Project ID]));
In the ON EXIT property of your start date and end date text boxes change your code to:
Code:
Me![Print Invoice Time Subform].Requery
Me![Print Invoice Expenses Subform].Requery
If Not IsNull(Me![begin date]) And Not IsNull(Me![end date]) Then
Me![total hours] = DLookup("[BilledHours]", "Qry_CurrentInVoice")
Me![total hourly billings] = DLookup("[BillAmt]", "Qry_CurrentInVoice")
End If
it's a bit brutish but it's quick and easy to make work, you'd do something similar for your expenses and likely on the report as well.