Hi. I'm working on a form that lets the user import data from another Access database. I'd like to let them choose a database from a particular path. In order to do that, I'd like to have a combo box containing the names of all Access files in that path.
I am able to get all the files with this code:
How can I filter out any files that are not .accdb files?
Thanks in advance for any help.
I am able to get all the files with this code:
Code:
Function UpdateFiles()
Dim dir, folder, files
Forms!fimport!filename.RowSource = ""
dir = Forms!fimport!path
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(dir)
Set files = folder.files
Forms!fimport!filename.RowSourceType = "Value List"
For Each file In files
Forms!fimport!filename.AddItem (file.Name)
Next
End Function
How can I filter out any files that are not .accdb files?
Thanks in advance for any help.