Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

showopen combo lists all files

Status
Not open for further replies.

bbuk

Technical User
Apr 27, 2002
44
GB
Hi

I am using the common dialog control showopen to allow the user to select an access database file to connect to. My problem is that the drop down filename box lists several files on various drives, including one on a removable drive which is not mounted. My questions are :

1 where are these filenames coming from?
2 how do I list only the filtered files in the current dir?

The test code below shows this problem on winxp pro

Any help appreciated.

Andy

Option Explicit
Dim strOpenFlag, strOpenFilter, strFileSelected As String


Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdOpen_Click()
strOpenFlag = cdlOFNHideReadOnly
strOpenFlag = strOpenFlag Or cdlOFNPathMustExist
strOpenFlag = strOpenFlag Or cdlOFNNoChangeDir
strOpenFilter = "Access Database (*.MDB) | *.mdb"

With Me.cdOpen1

.Flags = strOpenFlag
.InitDir = App.Path
.Filter = strOpenFilter
.ShowOpen

If Not .FileName = vbNullString Then
strFileSelected = .FileName
Else
strFileSelected = "No file selected"
End If

End With

MsgBox "File Selected is :" & vbCr & strFileSelected
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top