This is one way to add a Recordset to a Combo or List Box, by creating a temporary table, in the following example all files in c:\my documents and sub folders will be added to a combo/list box called MyList.
Paste the following into your form's declaration section:
Dim strMyCombo As String
Paste this into the form's module:
Sub CreateMyRowsource()
Dim dbs As Database, tdf As TableDef, Fld As Field
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef(strMyCombo)
With tdf
.Fields.Append .CreateField("Field1", dbText)
End With
dbs.TableDefs.Append tdf
dbs.Close
End Sub
This into the form's unload event:
On Error Resume Next
DoCmd.DeleteObject acTable, strMyCombo 'delete temp table
This into a button's on click event on your form to test it:
Dim dbs As Database, rst As Recordset
Dim i As Long, strFoundRef As String
On Error Resume Next
strMyCombo = Me.Name & Me!MyList.Name 'unique name for temp table
Me!MyList.RowSource = "" 'set your list / combo rowsourcw to nothing
DoCmd.DeleteObject acTable, strMyCombo 'delete temp table
CreateMyRowsource 'create temp table
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strMyCombo, dbOpenDynaset) 'set recordset = temp table
With Application.FileSearch
.LookIn = "c:\My Documents"
.Filename = "*.*"
.SearchSubFolders = True
If .Execute() > 0 Then
For i = 1 To .foundfiles.Count
rst.AddNew
rst!Field1 = .foundfiles(i)
rst.Update
Next i
End If
End With
Me!MyList.RowSourceType = "Table/Query"
'set your list / combo to temp table sorted by Field1
Me!MyList.RowSource = "SELECT Field1 FROM " & strMyCombo & " ORDER BY Field1;"
rst.Close
Obviously, rename MyList with your Combo/List name. In Access this has been the only way I've found to get around the 2048 character limit using a Value List with a recordset.