AngelSpeaks
Active member
- Local time
- Today, 10:34
- Joined
- Oct 21, 2021
- Messages
- 653
I have a combobox, cboDatabases. I am trying to load the names of Access Databases in the project's path into a combo box . When I step thru the code, I am seeing the database name, but it's not loading into the combo box. I did try to hardcode specific items into the combo box, but no success. The form is frmSelectCompany, row source type is "Value List", the width of the column is 4 inches.
Thanks
Here is the code:
Thanks
Here is the code:
Code:
Private Sub Form_Load()
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim strPath As String
strPath = CurrentProject.path
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(strPath)
For Each FileItem In SourceFolder.files
If Right(FileItem.Name, 6) = ".accdb" Then
Me.cboDataBases.AddItem (FileItem.Name)
End If
Next FileItem
End Sub