bambgrl
asked on
MS Access Form Browse Button
I have been utilizing the attached code to allow users to browse for a file within a directory and insert the filepath into a field. It worked great a few days ago, but all of a sudden it is giving an error: 'Compile Error: Sub or Function not Defined'
It highlights ahtAddFilterItem. I do not understand why it is doing this since it worked fine a few days ago. I cannot think of anything that changed.
Why am I getting this error?
Note: I did not generate this code, I found it here: https://www.experts-exchange.com/questions/21554625/Adding-a-browse-button-in-MS-Access-2000.html?sfQueryTermInfo=1+access+brows+button+form+ms
It highlights ahtAddFilterItem. I do not understand why it is doing this since it worked fine a few days ago. I cannot think of anything that changed.
Why am I getting this error?
Note: I did not generate this code, I found it here: https://www.experts-exchange.com/questions/21554625/Adding-a-browse-button-in-MS-Access-2000.html?sfQueryTermInfo=1+access+brows+button+form+ms
Private Sub BrowseTREND_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, _
"Word Documents (*.doc)", "*.doc")
strFilter = ahtAddFilterItem(strFilter, _
"Excel Files (*.xls)", "*.xls")
strFilter = ahtAddFilterItem(strFilter, _
"All files (*.*)", "*.*")
Me.FilePath = ahtCommonFileOpenSave(InitialDir:=strStartDir, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select File")
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER