ste4en
Technical User
- Aug 1, 2001
- 69
I am trying to use a Select Case statement instead of an IIF statement in a query. I think my attempt is self explainatory below but it is causing me problems and I suspect my syntax is wrong. I started off making it a public function but that did not work either:
In a select query I want to be able to use get the cost code for the activity code using something like CostCode: CostCodeN(ActivityCode)
Any help appreciated.
Thanks
Ste4en
In a select query I want to be able to use get the cost code for the activity code using something like CostCode: CostCodeN(ActivityCode)
Any help appreciated.
Thanks
Ste4en
Code:
Option Compare Database
Select Case CostCodeN
'determines the correct costcode for this activity code
Case Left(ActivityCode, 1) = "0": CostCode = ActivityCode
Case Left(ActivityCode, 1) = "9": CostCode = ActivityCode
Case Left(ActivityCode, 1) = "5": CostCode = "500120"
Else: CostCode = Left(ActivityCode, 3) & "000"
End Select