R
RML
Here is my code that works fine. However, there may be
times when nothing is in those fields and I get an error
about [Compress Model] = strFinal can't be empty. Would
like to be able to make it function if the fields are
empty thus producing a blank results field.
Thanks.
Dim strConcatenate As String
Dim strFinal As String
Dim strcheck As String
strConcatenate = IIf(IsNull([39]), "", [39] & ", ") & IIf
(IsNull([1]), "", [1] & ", ") & IIf(IsNull([2]), "", [2]
& ", ") & IIf(IsNull([3]), "", [3] & ", ") & IIf(IsNull
([4]), "", [4] & ", ") & IIf(IsNull([5]), "", [5] & ", ")
& IIf(IsNull([6]), "", [6] & ", ") & IIf(IsNull([7]), "",
[7] & ", ") & IIf(IsNull([8]), "", [8] & ", ") & IIf
(IsNull([9]), "", [9] & ", ") & IIf(IsNull([10]), "",
[10] & ", ") & IIf(IsNull([11]), "", [11] & ", ") & IIf
(IsNull([12]), "", [12] & ", ") & IIf(IsNull([13]), "",
[13] & ", ") & IIf(IsNull([14]), "", [14] & ", ") & IIf
(IsNull([15]), "", [15] & ", ") & IIf(IsNull([16]), "",
[16] & ", ") & IIf(IsNull([17]), "", [17] & ", ") & IIf
(IsNull([18]), "", [18] & ", ") & IIf(IsNull([19]), "",
[19] & ", ") & IIf(IsNull([20]), "", [20] & ", ") & IIf
(IsNull([21]), "", [21] & ", ") _
& IIf(IsNull([22]), "", [22] & ", ") & IIf(IsNull
([23]), "", [23] & ", ") & IIf(IsNull([24]), "", [24]
& ", ") & IIf(IsNull([25]), "", [25] & ", ") & IIf(IsNull
([26]), "", [26] & ", ") & IIf(IsNull([27]), "", [27]
& ", ") & IIf(IsNull([28]), "", [28] & ", ") & IIf(IsNull
([29]), "", [29] & ", ") & IIf(IsNull([30]), "", [30]
& ", ") & IIf(IsNull([31]), "", [31] & ", ") & IIf(IsNull
([32]), "", [32] & ", ") & IIf(IsNull([33]), "", [33]
& ", ") & IIf(IsNull([34]), "", [34] & ", ") & IIf(IsNull
([35]), "", [35] & ", ") & IIf(IsNull([36]), "", [36]
& ", ") & IIf(IsNull([37]), "", [37] & ", ") & IIf(IsNull
([40]), "", [40] & ", ") & IIf(IsNull([41]), "", [41]
& ", ") & IIf(IsNull([42]), "", [42] & ", ") & [38]
strcheck = Right(Trim(strConcatenate), 1)
If strcheck = "," Then
strFinal = Left(strConcatenate, Len(Trim
(strConcatenate)) - 1)
Else
strFinal = strConcatenate
End If
[Compress Model] = strFinal
times when nothing is in those fields and I get an error
about [Compress Model] = strFinal can't be empty. Would
like to be able to make it function if the fields are
empty thus producing a blank results field.
Thanks.
Dim strConcatenate As String
Dim strFinal As String
Dim strcheck As String
strConcatenate = IIf(IsNull([39]), "", [39] & ", ") & IIf
(IsNull([1]), "", [1] & ", ") & IIf(IsNull([2]), "", [2]
& ", ") & IIf(IsNull([3]), "", [3] & ", ") & IIf(IsNull
([4]), "", [4] & ", ") & IIf(IsNull([5]), "", [5] & ", ")
& IIf(IsNull([6]), "", [6] & ", ") & IIf(IsNull([7]), "",
[7] & ", ") & IIf(IsNull([8]), "", [8] & ", ") & IIf
(IsNull([9]), "", [9] & ", ") & IIf(IsNull([10]), "",
[10] & ", ") & IIf(IsNull([11]), "", [11] & ", ") & IIf
(IsNull([12]), "", [12] & ", ") & IIf(IsNull([13]), "",
[13] & ", ") & IIf(IsNull([14]), "", [14] & ", ") & IIf
(IsNull([15]), "", [15] & ", ") & IIf(IsNull([16]), "",
[16] & ", ") & IIf(IsNull([17]), "", [17] & ", ") & IIf
(IsNull([18]), "", [18] & ", ") & IIf(IsNull([19]), "",
[19] & ", ") & IIf(IsNull([20]), "", [20] & ", ") & IIf
(IsNull([21]), "", [21] & ", ") _
& IIf(IsNull([22]), "", [22] & ", ") & IIf(IsNull
([23]), "", [23] & ", ") & IIf(IsNull([24]), "", [24]
& ", ") & IIf(IsNull([25]), "", [25] & ", ") & IIf(IsNull
([26]), "", [26] & ", ") & IIf(IsNull([27]), "", [27]
& ", ") & IIf(IsNull([28]), "", [28] & ", ") & IIf(IsNull
([29]), "", [29] & ", ") & IIf(IsNull([30]), "", [30]
& ", ") & IIf(IsNull([31]), "", [31] & ", ") & IIf(IsNull
([32]), "", [32] & ", ") & IIf(IsNull([33]), "", [33]
& ", ") & IIf(IsNull([34]), "", [34] & ", ") & IIf(IsNull
([35]), "", [35] & ", ") & IIf(IsNull([36]), "", [36]
& ", ") & IIf(IsNull([37]), "", [37] & ", ") & IIf(IsNull
([40]), "", [40] & ", ") & IIf(IsNull([41]), "", [41]
& ", ") & IIf(IsNull([42]), "", [42] & ", ") & [38]
strcheck = Right(Trim(strConcatenate), 1)
If strcheck = "," Then
strFinal = Left(strConcatenate, Len(Trim
(strConcatenate)) - 1)
Else
strFinal = strConcatenate
End If
[Compress Model] = strFinal