Hi,
My query was working but now it doesn't work. I get an error of "Undefined Business Unit in expression"
My expression is
Field: Business Unit: BusinessUnit([CostCenter])
Table: Blank
Total: Expression
Sort: Blank
Show: Blank
Critiera: [Enter Business Unit]
I created a module that expression is pulling the Business Unit information. Below is my module:
[tt]Option Compare Database
Option Explicit
Function BusinessUnit(CostCenter As String)
If CostCenter = "3413" Or CostCenter = "3418" Or CostCenter = "3100" Or CostCenter = "3232" _
Or CostCenter = "3240" Or CostCenter = "3250" Or CostCenter = "3310" Or CostCenter = "3830" _
Or CostCenter = "3800" Or CostCenter = "3260" Or CostCenter = "3280" Or CostCenter = "3821" _
Or CostCenter = "3270" Or CostCenter = "3810" Or CostCenter = "3822" Or CostCenter = "3400" _
Or CostCenter = "3411" Or CostCenter = "3412" Or CostCenter = "3414" Or CostCenter = "3415" _
Or CostCenter = "3416" Or CostCenter = "3417" Or CostCenter = "3420" Then
BusinessUnit = ("Corporate Services"
ElseIf CostCenter = "3600" Or CostCenter = "3620" Or CostCenter = "3632" Or CostCenter = "3633" _
Or CostCenter = "3640" Or CostCenter = "3641" Or CostCenter = "3642" Or CostCenter = "3643" _
Or CostCenter = "3644" Or CostCenter = "3645" Or CostCenter = "3646" Or CostCenter = "3647" _
Or CostCenter = "3660" Or CostCenter = "3670" Or CostCenter = "3671" Or CostCenter = "3650" _
Or CostCenter = "3651" Or CostCenter = "3652" Or CostCenter = "3653" Or CostCenter = "3654" _
Or CostCenter = "3655" Or CostCenter = "3610" Or CostCenter = "3630" Or CostCenter = "3900" _
Or CostCenter = "3996" Or CostCenter = "3940" Or CostCenter = "3959" Or CostCenter = "3901" _
Or CostCenter = "3903" Or CostCenter = "3904" Or CostCenter = "3909" Or CostCenter = "3924" _
Or CostCenter = "3926" Or CostCenter = "3949" Or CostCenter = "3920" Or CostCenter = "3931" _
Or CostCenter = "3944" Or CostCenter = "3945" Or CostCenter = "3946" Or CostCenter = "3947" _
Or CostCenter = "3948" Or CostCenter = "3951" Or CostCenter = "3952" Or CostCenter = "3953" _
Or CostCenter = "3954" Or CostCenter = "3955" Or CostCenter = "3956" Or CostCenter = "3957" _
Or CostCenter = "3958" Or CostCenter = "3980" Or CostCenter = "3985" Or CostCenter = "3990" _
Or CostCenter = "3996" Or CostCenter = "3907" Or CostCenter = "3908" Or CostCenter = "3915" _
Or CostCenter = "3927" Or CostCenter = "3960" Or CostCenter = "3965" Or CostCenter = "3902" _
Or CostCenter = "3995" Or CostCenter = "3994" Or CostCenter = "3997" Or CostCenter = "3998" _
Or CostCenter = "3999" Then
BusinessUnit = ("SECTOR"
ElseIf CostCenter = "4001" Or CostCenter = "4100" Or CostCenter = "4200" Or CostCenter = "4205" _
Or CostCenter = "4210" Or CostCenter = "4220" Or CostCenter = "4230" Or CostCenter = "4231" _
Or CostCenter = "4232" Or CostCenter = "4240" Or CostCenter = "4241" Or CostCenter = "4242" _
Or CostCenter = "4243" Or CostCenter = "4244" Or CostCenter = "4245" Or CostCenter = "4250" _
Or CostCenter = "4251" Or CostCenter = "4252" Or CostCenter = "4253" Or CostCenter = "4260" _
Or CostCenter = "4270" Or CostCenter = "4300" Or CostCenter = "4310" Or CostCenter = "4320" _
Or CostCenter = "4321" Or CostCenter = "4323" Or CostCenter = "4324" Or CostCenter = "4330" _
Or CostCenter = "4331" Or CostCenter = "4332" Or CostCenter = "4333" Or CostCenter = "4334" _
Or CostCenter = "4335" Or CostCenter = "4340" Or CostCenter = "4326" Or CostCenter = "4341" _
Or CostCenter = "4342" Or CostCenter = "4343" Or CostCenter = "4344" Or CostCenter = "4347" _
Or CostCenter = "4349" Or CostCenter = "4383" Or CostCenter = "4384" Or CostCenter = "4350" _
Or CostCenter = "4345" Or CostCenter = "4348" Or CostCenter = "4351" Or CostCenter = "4352" _
Or CostCenter = "4353" Or CostCenter = "4360" Or CostCenter = "4002" Or CostCenter = "4380" _
Or CostCenter = "4381" Or CostCenter = "4386" Or CostCenter = "4399" Or CostCenter = "4685" _
Or CostCenter = "4600" Or CostCenter = "4601" Or CostCenter = "4609" Or CostCenter = "4610" _
Or CostCenter = "4620" Or CostCenter = "4625" Or CostCenter = "4630" Or CostCenter = "4635" _
Or CostCenter = "4640" Or CostCenter = "4650" Or CostCenter = "4680" Or CostCenter = "4690" _
Or CostCenter = "4693" Or CostCenter = "4700" Or CostCenter = "4710" Or CostCenter = "4720" _
Or CostCenter = "4730" Or CostCenter = "4740" Or CostCenter = "4750" Or CostCenter = "4800" _
Or CostCenter = "4830" Or CostCenter = "4801" Or CostCenter = "4841" Or CostCenter = "4840" _
Or CostCenter = "4842" Or CostCenter = "4870" Or CostCenter = "4811" Or CostCenter = "4805" _
Or CostCenter = "4810" Or CostCenter = "4820" Or CostCenter = "4850" Or CostCenter = "4890" _
Or CostCenter = "4860" Or CostCenter = "4861" Or CostCenter = "4862" Or CostCenter = "4900" _
Or CostCenter = "4910" Or CostCenter = "4920" Or CostCenter = "4921" Or CostCenter = "4922" _
Or CostCenter = "4930" Or CostCenter = "4941" Or CostCenter = "4940" Or CostCenter = "4942" Then
BusinessUnit = ("NYSE SERVICES"
ElseIf CostCenter = "4943" Or CostCenter = "4944" Or CostCenter = "4802" Then
BusinessUnit = ("NYSE SERVICES"
ElseIf CostCenter = "5200" Or CostCenter = "5210" Or CostCenter = "5220" Or CostCenter = "5230" _
Or CostCenter = "5240" Or CostCenter = "5241" Or CostCenter = "5250" Or CostCenter = "5260" _
Or CostCenter = "5270" Or CostCenter = "5280" Or CostCenter = "5300" Or CostCenter = "5380" _
Or CostCenter = "5303" Or CostCenter = "5310" Or CostCenter = "5320" Or CostCenter = "5330" _
Or CostCenter = "5340" Or CostCenter = "5341" Or CostCenter = "5360" Or CostCenter = "5370" _
Or CostCenter = "5390" Or CostCenter = "5395" Then
BusinessUnit = ("AMEX SERVICES"
ElseIf CostCenter = "5401" Or CostCenter = "5490" Or CostCenter = "5492" Or CostCenter = "5493" _
Or CostCenter = "5495" Or CostCenter = "5494" Or CostCenter = "5497" Or CostCenter = "5498" _
Or CostCenter = "5402" Or CostCenter = "5410" Or CostCenter = "5431" Or CostCenter = "5441" _
Or CostCenter = "5464" Or CostCenter = "5470" Or CostCenter = "5482" Or CostCenter = "5484" _
Or CostCenter = "5420" Or CostCenter = "5422" Or CostCenter = "5423" Or CostCenter = "5403" _
Or CostCenter = "5425" Or CostCenter = "5430" Or CostCenter = "5450" Or CostCenter = "5404" _
Or CostCenter = "5480" Or CostCenter = "5496" Or CostCenter = "5466" Or CostCenter = "5467" Then
BusinessUnit = ("Shared Data Center"
ElseIf CostCenter = "0" Then
BusinessUnit = "No Cost Center Info"
Else
BusinessUnit = Null
End If
End Function [/tt]
My query was working but now it doesn't work. I get an error of "Undefined Business Unit in expression"
My expression is
Field: Business Unit: BusinessUnit([CostCenter])
Table: Blank
Total: Expression
Sort: Blank
Show: Blank
Critiera: [Enter Business Unit]
I created a module that expression is pulling the Business Unit information. Below is my module:
[tt]Option Compare Database
Option Explicit
Function BusinessUnit(CostCenter As String)
If CostCenter = "3413" Or CostCenter = "3418" Or CostCenter = "3100" Or CostCenter = "3232" _
Or CostCenter = "3240" Or CostCenter = "3250" Or CostCenter = "3310" Or CostCenter = "3830" _
Or CostCenter = "3800" Or CostCenter = "3260" Or CostCenter = "3280" Or CostCenter = "3821" _
Or CostCenter = "3270" Or CostCenter = "3810" Or CostCenter = "3822" Or CostCenter = "3400" _
Or CostCenter = "3411" Or CostCenter = "3412" Or CostCenter = "3414" Or CostCenter = "3415" _
Or CostCenter = "3416" Or CostCenter = "3417" Or CostCenter = "3420" Then
BusinessUnit = ("Corporate Services"
ElseIf CostCenter = "3600" Or CostCenter = "3620" Or CostCenter = "3632" Or CostCenter = "3633" _
Or CostCenter = "3640" Or CostCenter = "3641" Or CostCenter = "3642" Or CostCenter = "3643" _
Or CostCenter = "3644" Or CostCenter = "3645" Or CostCenter = "3646" Or CostCenter = "3647" _
Or CostCenter = "3660" Or CostCenter = "3670" Or CostCenter = "3671" Or CostCenter = "3650" _
Or CostCenter = "3651" Or CostCenter = "3652" Or CostCenter = "3653" Or CostCenter = "3654" _
Or CostCenter = "3655" Or CostCenter = "3610" Or CostCenter = "3630" Or CostCenter = "3900" _
Or CostCenter = "3996" Or CostCenter = "3940" Or CostCenter = "3959" Or CostCenter = "3901" _
Or CostCenter = "3903" Or CostCenter = "3904" Or CostCenter = "3909" Or CostCenter = "3924" _
Or CostCenter = "3926" Or CostCenter = "3949" Or CostCenter = "3920" Or CostCenter = "3931" _
Or CostCenter = "3944" Or CostCenter = "3945" Or CostCenter = "3946" Or CostCenter = "3947" _
Or CostCenter = "3948" Or CostCenter = "3951" Or CostCenter = "3952" Or CostCenter = "3953" _
Or CostCenter = "3954" Or CostCenter = "3955" Or CostCenter = "3956" Or CostCenter = "3957" _
Or CostCenter = "3958" Or CostCenter = "3980" Or CostCenter = "3985" Or CostCenter = "3990" _
Or CostCenter = "3996" Or CostCenter = "3907" Or CostCenter = "3908" Or CostCenter = "3915" _
Or CostCenter = "3927" Or CostCenter = "3960" Or CostCenter = "3965" Or CostCenter = "3902" _
Or CostCenter = "3995" Or CostCenter = "3994" Or CostCenter = "3997" Or CostCenter = "3998" _
Or CostCenter = "3999" Then
BusinessUnit = ("SECTOR"
ElseIf CostCenter = "4001" Or CostCenter = "4100" Or CostCenter = "4200" Or CostCenter = "4205" _
Or CostCenter = "4210" Or CostCenter = "4220" Or CostCenter = "4230" Or CostCenter = "4231" _
Or CostCenter = "4232" Or CostCenter = "4240" Or CostCenter = "4241" Or CostCenter = "4242" _
Or CostCenter = "4243" Or CostCenter = "4244" Or CostCenter = "4245" Or CostCenter = "4250" _
Or CostCenter = "4251" Or CostCenter = "4252" Or CostCenter = "4253" Or CostCenter = "4260" _
Or CostCenter = "4270" Or CostCenter = "4300" Or CostCenter = "4310" Or CostCenter = "4320" _
Or CostCenter = "4321" Or CostCenter = "4323" Or CostCenter = "4324" Or CostCenter = "4330" _
Or CostCenter = "4331" Or CostCenter = "4332" Or CostCenter = "4333" Or CostCenter = "4334" _
Or CostCenter = "4335" Or CostCenter = "4340" Or CostCenter = "4326" Or CostCenter = "4341" _
Or CostCenter = "4342" Or CostCenter = "4343" Or CostCenter = "4344" Or CostCenter = "4347" _
Or CostCenter = "4349" Or CostCenter = "4383" Or CostCenter = "4384" Or CostCenter = "4350" _
Or CostCenter = "4345" Or CostCenter = "4348" Or CostCenter = "4351" Or CostCenter = "4352" _
Or CostCenter = "4353" Or CostCenter = "4360" Or CostCenter = "4002" Or CostCenter = "4380" _
Or CostCenter = "4381" Or CostCenter = "4386" Or CostCenter = "4399" Or CostCenter = "4685" _
Or CostCenter = "4600" Or CostCenter = "4601" Or CostCenter = "4609" Or CostCenter = "4610" _
Or CostCenter = "4620" Or CostCenter = "4625" Or CostCenter = "4630" Or CostCenter = "4635" _
Or CostCenter = "4640" Or CostCenter = "4650" Or CostCenter = "4680" Or CostCenter = "4690" _
Or CostCenter = "4693" Or CostCenter = "4700" Or CostCenter = "4710" Or CostCenter = "4720" _
Or CostCenter = "4730" Or CostCenter = "4740" Or CostCenter = "4750" Or CostCenter = "4800" _
Or CostCenter = "4830" Or CostCenter = "4801" Or CostCenter = "4841" Or CostCenter = "4840" _
Or CostCenter = "4842" Or CostCenter = "4870" Or CostCenter = "4811" Or CostCenter = "4805" _
Or CostCenter = "4810" Or CostCenter = "4820" Or CostCenter = "4850" Or CostCenter = "4890" _
Or CostCenter = "4860" Or CostCenter = "4861" Or CostCenter = "4862" Or CostCenter = "4900" _
Or CostCenter = "4910" Or CostCenter = "4920" Or CostCenter = "4921" Or CostCenter = "4922" _
Or CostCenter = "4930" Or CostCenter = "4941" Or CostCenter = "4940" Or CostCenter = "4942" Then
BusinessUnit = ("NYSE SERVICES"
ElseIf CostCenter = "4943" Or CostCenter = "4944" Or CostCenter = "4802" Then
BusinessUnit = ("NYSE SERVICES"
ElseIf CostCenter = "5200" Or CostCenter = "5210" Or CostCenter = "5220" Or CostCenter = "5230" _
Or CostCenter = "5240" Or CostCenter = "5241" Or CostCenter = "5250" Or CostCenter = "5260" _
Or CostCenter = "5270" Or CostCenter = "5280" Or CostCenter = "5300" Or CostCenter = "5380" _
Or CostCenter = "5303" Or CostCenter = "5310" Or CostCenter = "5320" Or CostCenter = "5330" _
Or CostCenter = "5340" Or CostCenter = "5341" Or CostCenter = "5360" Or CostCenter = "5370" _
Or CostCenter = "5390" Or CostCenter = "5395" Then
BusinessUnit = ("AMEX SERVICES"
ElseIf CostCenter = "5401" Or CostCenter = "5490" Or CostCenter = "5492" Or CostCenter = "5493" _
Or CostCenter = "5495" Or CostCenter = "5494" Or CostCenter = "5497" Or CostCenter = "5498" _
Or CostCenter = "5402" Or CostCenter = "5410" Or CostCenter = "5431" Or CostCenter = "5441" _
Or CostCenter = "5464" Or CostCenter = "5470" Or CostCenter = "5482" Or CostCenter = "5484" _
Or CostCenter = "5420" Or CostCenter = "5422" Or CostCenter = "5423" Or CostCenter = "5403" _
Or CostCenter = "5425" Or CostCenter = "5430" Or CostCenter = "5450" Or CostCenter = "5404" _
Or CostCenter = "5480" Or CostCenter = "5496" Or CostCenter = "5466" Or CostCenter = "5467" Then
BusinessUnit = ("Shared Data Center"
ElseIf CostCenter = "0" Then
BusinessUnit = "No Cost Center Info"
Else
BusinessUnit = Null
End If
End Function [/tt]