Part of the fun in Waldo W.'s job is working with third-party data providers and figuring out how to integrate the data into his company's applications. One of Waldo's favorite data providers is a Certain Address Data Service.
The address data provided by the vendor is partitioned into Odd and Even ranges for a given street. Sometimes -- usually when there are not a whole lot of addresses on a street -- the vendor puts them in the Both range. And this resulted in the following code being written to determine the evenness, oddness or bothness of the address entered...
If IsNumeric(StreetNumberValue) Then If 2 Mod CType(StreetNumberValue, Integer) = 0 Then OddEven = "E" 'Even Else OddEven = "O" 'Odd End If Else OddEven = "B" 'Both End If
As a bonus, the function that contains this code segment also made use of the StringBuilder concatenation pattern:
With myStringBuilder .Append(OddEven & "' = ODDEVEN or ODDEVEN = 'B' or '") .Append(OddEven & "' = '' or ODDEVEN IS NULL) ") End With