With Access 2007, I have successfully used this code in the past to open a Browse... window for importing Excel files with a form button.
Private Sub SelectSurvey_Click()
Dim strStartDir As String
Dim strFilter As String
Dim lngFlags As Long
' Lets start the file browse from our current directory
strStartDir = CurrentDb.Name
strStartDir = Left(strStartDir, Len(strStartDir) - Len(Dir(strStartDir)))
strFilter = ahtAddFilterItem(strFilter, _
"Excel Files (*.xls)", "*.xls")
Me.txtFileName = ahtCommonFileOpenSave(InitialDir:=strStartDir, _
Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
However, I am now using Access 2010 and I receive the error "Method or data member not found" in association with "txtFileName".
I am not sure if it is the newer version of Access (or something else) that is causing this.
Does anyone have a suggestion for how to get this function working? I am willing to try a whole new set of code if that is what will be necessary.