I've spent many hours searching forums for some conversation/solutions about this, but with no luck so here goes:
I started with the MSDN basic VBA code for Weekdays and Workdays functions to give me the number of workdays between two dates.
(see:
http://msdn.microsoft.com/en-us/library/dd327646(office.12).aspx
)
I changed the appropriate fields to match my database (startdate = Date_recd; enddate= ePAF_COSApp), and have created the corresponding tblHolidays. In every "date" instance, these are formatted as date/time.
The results in the query are correct. For example:
WrkDays-RecdtoCOSApp: Workdays([Date_recd],[ePAF_COSApp])
Date_recd: 9/1/09
ePAF_COSApp: 9/16/09
9/7/09 was a holiday
11 workdays
I need both the number of workdays and average of workdays across a given criteria.
Using the query results for the calculated workdays ([qryreceived-COSAPP-HRAPP_1]), I created a separate simple query that calculates the average workdays for each form type being processed:
SELECT [qryreceived-COSApp-HRApp_1].eForm_Type, Avg([qryreceived-COSApp-HRApp_1].[WrkDays-RecdtoCOSApp]) AS [AvgOfWrkDays-RecdtoCOSApp]
FROM [qryreceived-COSApp-HRApp_1]
GROUP BY [qryreceived-COSApp-HRApp_1].eForm_Type;
Problem: I get a "data type mismatch in criteria expression" error. The problem is with "WrkDays" ... it's like it's not reading the number as an integer.
I'm convinced that it has to do with the Workdays VBA coding regarding the strWhere and Holiday count... but can't seem to put my finger on exactly what's wrong.
I could be way off base, and appreciate any advice.
COS_T
I started with the MSDN basic VBA code for Weekdays and Workdays functions to give me the number of workdays between two dates.
(see:
http://msdn.microsoft.com/en-us/library/dd327646(office.12).aspx
)
I changed the appropriate fields to match my database (startdate = Date_recd; enddate= ePAF_COSApp), and have created the corresponding tblHolidays. In every "date" instance, these are formatted as date/time.
The results in the query are correct. For example:
WrkDays-RecdtoCOSApp: Workdays([Date_recd],[ePAF_COSApp])
Date_recd: 9/1/09
ePAF_COSApp: 9/16/09
9/7/09 was a holiday
11 workdays
I need both the number of workdays and average of workdays across a given criteria.
Using the query results for the calculated workdays ([qryreceived-COSAPP-HRAPP_1]), I created a separate simple query that calculates the average workdays for each form type being processed:
SELECT [qryreceived-COSApp-HRApp_1].eForm_Type, Avg([qryreceived-COSApp-HRApp_1].[WrkDays-RecdtoCOSApp]) AS [AvgOfWrkDays-RecdtoCOSApp]
FROM [qryreceived-COSApp-HRApp_1]
GROUP BY [qryreceived-COSApp-HRApp_1].eForm_Type;
Problem: I get a "data type mismatch in criteria expression" error. The problem is with "WrkDays" ... it's like it's not reading the number as an integer.
I'm convinced that it has to do with the Workdays VBA coding regarding the strWhere and Holiday count... but can't seem to put my finger on exactly what's wrong.
I could be way off base, and appreciate any advice.
COS_T