Karl,
The form contains general information about materials and it's primarily DLookup, DSum and DAvg for the textboxes on the form. It's a tool that the sales team uses to quote times to the customer on how long it will take to standard items. The textbox in
question, I need to link to the source table to get the average time (DateDiff) between when we start and when we end a items manufacturing. The SQL statement I used to get the result is...
SELECT tblOrders.Material, Avg(DateDiff("d", StartDate, EndDate)) AS Average
FROM tblOrders
WHERE Material='123456789' AND tblOrders.EndDate BETWEEN #01/01/2013# AND #05/31/2013#
It returns the correct value, but I need that value to be in the textbox on the form, running when they change the combobox (cmbMaterial). I know how to set the RowSource, just not how to return the Average DateDiff for a specific date range and material.
I apologize, I deal with Excel 99.9% of the day, what is the record source of the SQL form? This was a blank form I created that is mainly producing totals for date ranges via VBA because the data comes from multiple company sources.
Would it be wise to calculate the Date Difference into the initial table, then do the Average for the Row Source?