Please bear with me as I am still a novice.
I've created several modules in my database that when expressed in a query would "group" the data accordingly. It usually works like a charm. However, I get a "data type mismatch in criteria expression" error message for the following module when I use it in an expression in my query. I can't figure out why.
The module is set up as follows (below that is the query's sql):
Function JobGroup(Skill As String)
If Skill = "C/C++" Or Skill = "COBOL/CICS" _
Or Skill = "Middleware" Or Skill = "Motif" _
Or Skill = "Object Design" Or Skill = "OCS/2" _
Or Skill = "Paradox" Or Skill = "TAL" _
Or Skill = "Visual Basic" Then
JobGroup = CStr("Development"
ElseIf Skill = "Comm. Engineering" Or Skill = "LAN/WAN" _
Or Skill = "Comm. Technician" Or Skill = "Networking" Then
JobGroup = CStr("Network/Communications"
ElseIf Skill = "Administration" Or Skill = "Checkpoint" _
Or Skill = "DCE" Or Skill = "Gauntlet" Or Skill = "HP" _
Or Skill = "ISIS" Or Skill = "Sys Admin - UNIX" Then
JobGroup = CStr("Systems Administration"
ElseIf Skill = "Project Management" Or Skill = "Technical Writing" Then
JobGroup = CStr("Project Management"
ElseIf Skill = "Quality Assurance" Then
JobGroup = CStr("Quality Assurance"
Else
JobGroup = Null
End If
End Function
I then set up a query that would Group by Skill and includes skill, level, min. rate, max. rate, average rate and number of people in each group.
The sql for the query is as follows:
SELECT DISTINCTROW JobGroup([Skill]) AS [Job Group], [Consultants on Board].Skill, [By Grouping].Level, Avg([Consultants on Board].CurrentRate) AS [Avg Of Rate], Min([Consultants on Board].CurrentRate) AS [Min Of Rate Desired], Max([Consultants on Board].CurrentRate) AS [Msx Of Rate Desired], Count(*) AS [Count Of By Grouping]
FROM [Consultants on Board] INNER JOIN [By Grouping] ON [Consultants on Board].Name = [By Grouping].Name
GROUP BY JobGroup([Skill]), [Consultants on Board].Skill, [By Grouping].Level;
I've created several modules in my database that when expressed in a query would "group" the data accordingly. It usually works like a charm. However, I get a "data type mismatch in criteria expression" error message for the following module when I use it in an expression in my query. I can't figure out why.
The module is set up as follows (below that is the query's sql):
Function JobGroup(Skill As String)
If Skill = "C/C++" Or Skill = "COBOL/CICS" _
Or Skill = "Middleware" Or Skill = "Motif" _
Or Skill = "Object Design" Or Skill = "OCS/2" _
Or Skill = "Paradox" Or Skill = "TAL" _
Or Skill = "Visual Basic" Then
JobGroup = CStr("Development"
ElseIf Skill = "Comm. Engineering" Or Skill = "LAN/WAN" _
Or Skill = "Comm. Technician" Or Skill = "Networking" Then
JobGroup = CStr("Network/Communications"
ElseIf Skill = "Administration" Or Skill = "Checkpoint" _
Or Skill = "DCE" Or Skill = "Gauntlet" Or Skill = "HP" _
Or Skill = "ISIS" Or Skill = "Sys Admin - UNIX" Then
JobGroup = CStr("Systems Administration"
ElseIf Skill = "Project Management" Or Skill = "Technical Writing" Then
JobGroup = CStr("Project Management"
ElseIf Skill = "Quality Assurance" Then
JobGroup = CStr("Quality Assurance"
Else
JobGroup = Null
End If
End Function
I then set up a query that would Group by Skill and includes skill, level, min. rate, max. rate, average rate and number of people in each group.
The sql for the query is as follows:
SELECT DISTINCTROW JobGroup([Skill]) AS [Job Group], [Consultants on Board].Skill, [By Grouping].Level, Avg([Consultants on Board].CurrentRate) AS [Avg Of Rate], Min([Consultants on Board].CurrentRate) AS [Min Of Rate Desired], Max([Consultants on Board].CurrentRate) AS [Msx Of Rate Desired], Count(*) AS [Count Of By Grouping]
FROM [Consultants on Board] INNER JOIN [By Grouping] ON [Consultants on Board].Name = [By Grouping].Name
GROUP BY JobGroup([Skill]), [Consultants on Board].Skill, [By Grouping].Level;