Option Compare Database
Option Explicit

' ** Access Toolbox Module **
' on 2017-02-28,
' @author: Olivier Massot
' V 1.0

' Operations on iterables

Public Function concat(ByRef iterable As Variant, Optional separator As String = ";")
    Dim var As Variant
    
    concat = ""
    For Each var In iterable
        If Len(concat) > 0 Then concat = concat & separator
        concat = concat & CStr(var)
    Next var

End Function

Function contains(ByRef iterable As Variant, value As Variant) As Boolean
    Dim i As Integer
    contains = False
    If is_empty(iterable) Then Exit Function
    For i = LBound(iterable) To UBound(iterable)
        If iterable(i) = value Then
            contains = True
            Exit Function
        End If
    Next i
End Function

Public Function is_empty(iterable As Variant) As Boolean
Dim var As Variant
is_empty = True

On Error Resume Next
var = UBound(Tableau)
On Error GoTo 0

is_empty = IsEmpty(var)

End Function