A
Access05
Hi,
I'm trying to pass this function to return a character string but I'm
getting a type mismatch error 13 I dumped the contents of BU and it
looks fine but as soon as I press further, I get this error.
Progress 1, "Adding new fields ..." ' and changing
YEARMON to a text field ..."
strSQL = "SELECT *, left(yearmon,4) as YR," _
& " GetBranch([BU]) AS BRANCH," <=== trying to
pass a field called BU
strSQL = strSQL & "IIf([team] In
('1','2','5','8',),'Specialized Claims Services'," _
& "IIf([team] In ('0', 'O'),'Health Services'," _
& "IIf([team] In ('6'),'Regulatory Claims
Officers'," _
& "IIf([team] In ('Z'),'Specialized Claims
Services'," _
& "IIf([district] In ('K','G'),'Service
Delivery'," _
& "IIf([team] In ('A'),'Service Delivery'," _
& "IIf([district] In
('U','M','S','Y','N'),'Service Delivery'," _
& "IIf([team] In ('D'),'Unknown/Other'," _
& "IIf([district] In ('T') and [team] In
('B','F','L','M','S','E','H','V','C','T','9'),'Service Delivery'," _
& "IIf([district] In
('Q','R','H','A','C','W','L'),'Service Delivery','Unknown/
Other')))))))))) AS DIVISION INTO " _
& dataTable & " FROM " & tempTable & ";"
'MsgBox strSQL
'CurrentDb.Execute strSQL
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
..
..
..
in Main pgm
Function GetBranch(BU as String) As String
Dim strDist, strTeam As String
MsgBox BU <== looks fine here
strDist = Right(BU, 1)
strTeam = Left(BU, 1)
MsgBox strDist, strTeam <== once I split them up, I get the type
mismatch 13 error ?
' Select Case Right(BU, 1) Or Left(BU, 1)
Select Case strDist Or strTeam
Case strDist = "1"
GetBranch = "Central Claims Processing"
Case strDist = "2"
GetBranch = "Admin Services"
Case strDist = "5"
GetBranch = "ISC"
Case strDist = "8"
GetBranch = "Pre-1990"
Case strDist = "5"
GetBranch = "ISC"
Case strDist = "O", "0"
GetBranch = "Occupational Disease & SBP"
Case strDist = "6"
GetBranch = "Regulatory Claims Officers"
Case strTeam = "K", "G"
GetBranch = "Kitchener/Guelph"
Case strDist = "A"
GetBranch = "Kitchener/Guelph"
Case strTeam = "U", "M"
GetBranch = "Thunder Bay/SSM"
Case strTeam = "S", "Y", "N"
GetBranch = "Sudbury/Timmins/North Bay"
Case strDist = "D"
GetBranch = "Unknown/Other"
Case strTeam = "T"
If strDist = "F" Or "L" Or "M" Then
GetBranch = "Industrial"
End If
Case strTeam = "T"
If (strDist = "S" Or "E") Then
GetBranch = "Government Services"
End If
Case strTeam = "T"
If (strDist = "H" Or "V") Then
GetBranch = "Services & Health Care"
End If
Case strTeam = "T"
If (strDist = "C" Or "T") Then
GetBranch = "Transportation & Construction"
End If
Case strTeam = "T"
If (strDist = "9") Then
GetBranch = "Small Business"
End If
Case strTeam = "Q", "R"
GetBranch = "Ottawa/Kingston"
Case strTeam = "H", "A", "C"
GetBranch = "Hamilton/St. Catherines"
Case strTeam = "W"
GetBranch = "Windsor"
Case strTeam = "L"
GetBranch = "London"
Case Else
GetBranch = "Unknown/Other"
End Select
End Function
Any suggestions?
Thanks,
Rose
I'm trying to pass this function to return a character string but I'm
getting a type mismatch error 13 I dumped the contents of BU and it
looks fine but as soon as I press further, I get this error.
Progress 1, "Adding new fields ..." ' and changing
YEARMON to a text field ..."
strSQL = "SELECT *, left(yearmon,4) as YR," _
& " GetBranch([BU]) AS BRANCH," <=== trying to
pass a field called BU
strSQL = strSQL & "IIf([team] In
('1','2','5','8',),'Specialized Claims Services'," _
& "IIf([team] In ('0', 'O'),'Health Services'," _
& "IIf([team] In ('6'),'Regulatory Claims
Officers'," _
& "IIf([team] In ('Z'),'Specialized Claims
Services'," _
& "IIf([district] In ('K','G'),'Service
Delivery'," _
& "IIf([team] In ('A'),'Service Delivery'," _
& "IIf([district] In
('U','M','S','Y','N'),'Service Delivery'," _
& "IIf([team] In ('D'),'Unknown/Other'," _
& "IIf([district] In ('T') and [team] In
('B','F','L','M','S','E','H','V','C','T','9'),'Service Delivery'," _
& "IIf([district] In
('Q','R','H','A','C','W','L'),'Service Delivery','Unknown/
Other')))))))))) AS DIVISION INTO " _
& dataTable & " FROM " & tempTable & ";"
'MsgBox strSQL
'CurrentDb.Execute strSQL
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
..
..
..
in Main pgm
Function GetBranch(BU as String) As String
Dim strDist, strTeam As String
MsgBox BU <== looks fine here
strDist = Right(BU, 1)
strTeam = Left(BU, 1)
MsgBox strDist, strTeam <== once I split them up, I get the type
mismatch 13 error ?
' Select Case Right(BU, 1) Or Left(BU, 1)
Select Case strDist Or strTeam
Case strDist = "1"
GetBranch = "Central Claims Processing"
Case strDist = "2"
GetBranch = "Admin Services"
Case strDist = "5"
GetBranch = "ISC"
Case strDist = "8"
GetBranch = "Pre-1990"
Case strDist = "5"
GetBranch = "ISC"
Case strDist = "O", "0"
GetBranch = "Occupational Disease & SBP"
Case strDist = "6"
GetBranch = "Regulatory Claims Officers"
Case strTeam = "K", "G"
GetBranch = "Kitchener/Guelph"
Case strDist = "A"
GetBranch = "Kitchener/Guelph"
Case strTeam = "U", "M"
GetBranch = "Thunder Bay/SSM"
Case strTeam = "S", "Y", "N"
GetBranch = "Sudbury/Timmins/North Bay"
Case strDist = "D"
GetBranch = "Unknown/Other"
Case strTeam = "T"
If strDist = "F" Or "L" Or "M" Then
GetBranch = "Industrial"
End If
Case strTeam = "T"
If (strDist = "S" Or "E") Then
GetBranch = "Government Services"
End If
Case strTeam = "T"
If (strDist = "H" Or "V") Then
GetBranch = "Services & Health Care"
End If
Case strTeam = "T"
If (strDist = "C" Or "T") Then
GetBranch = "Transportation & Construction"
End If
Case strTeam = "T"
If (strDist = "9") Then
GetBranch = "Small Business"
End If
Case strTeam = "Q", "R"
GetBranch = "Ottawa/Kingston"
Case strTeam = "H", "A", "C"
GetBranch = "Hamilton/St. Catherines"
Case strTeam = "W"
GetBranch = "Windsor"
Case strTeam = "L"
GetBranch = "London"
Case Else
GetBranch = "Unknown/Other"
End Select
End Function
Any suggestions?
Thanks,
Rose