Public Function aaDLookup_Array(strField As String, _ strDomain As String, _ Optional strCriteria As String) As Variant() Dim arrResult() As Variant Dim rst As ADODB.Recordset Dim strSQL As String 'Set up SQL WHERE clause, if supplied If Not strCriteria = "" Then strCriteria = "WHERE " & strCriteria End If strSQL = "SELECT " & strField & " FROM " & _ strDomain & strCriteria 'Loop through recordset Set rst = New ADODB.Recordset rst.Open strSQL, CurrentProject.Connection, _ adOpenStatic, adLockOptimistic Dim lngCount As Long With rst If .RecordCount > 0 Then ReDim arrResult(.RecordCount) As Variant For lngCount = 0 To .RecordCount - 1 arrResult(lngCount) = .Fields(strField) .MoveNext Next lngCount End If .Close End With Set rst = Nothing aaDLookup_Array = arrResult End Function