Filling a Combo Box with a Disconnected Recordset
Private Sub Form_Load()
Dim myRecordset As ADODB.Recordset
Dim strRowSource As String
Dim strName As String
strName = CurrentProject.Path & "\Companies.rst"
Set myRecordset = New ADODB.Recordset
With myRecordset
.CursorLocation = adUseClient
.Open strName, , , , adCmdFile
Do Until .EOF
strRowSource = strRowSource & myRecordset!CompanyName & ";"
.MoveNext
Loop
With Me.cboCompany
.RowSourceType = "Value List"
.RowSource = strRowSource
End With
.Close
End With
Set myRecordset = Nothing
End Sub
Related examples in the same category