Folder access (Access 2003)

  • Thread starter Thread starter H. Martins
  • Start date Start date
H

H. Martins

Hi,

I'm implementing this method so that people can access files and open
them according to folder location previously stored in a configuration
table.

====================================

Private Sub btnPautas_Click()

On Error GoTo btnPautas_Click_Error

Dim strFolder As String
strFolder = "\\server-1\exam\calcs\2009" 'as example

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave(InitialDir:=strFolder, _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

Application.FollowHyperlink strInputFileName

On Error GoTo 0
Exit Sub

btnPautas_Click_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure btnPautas_Click of VBA Document Form_TurmasConstituicaoDe"

End Sub

==========================

It works OK but I have a problem: people can 'travel' above the '2009'
folder and from them to other child folders.

Is there a way to say 'clip' the access to parent folders? If not, Is
there some other method to get the required result?

Thanks
H. Martins
 
Am Donnerstag, 8. März 2012 11:29:49 UTC+1 schrieb H. Martins:
Hi,

I'm implementing this method so that people can access files and open
them according to folder location previously stored in a configuration
table.

====================================

Private Sub btnPautas_Click()

On Error GoTo btnPautas_Click_Error

Dim strFolder As String
strFolder = "\\server-1\exam\calcs\2009" 'as example

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave(InitialDir:=strFolder, _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

Application.FollowHyperlink strInputFileName

On Error GoTo 0
Exit Sub

btnPautas_Click_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure btnPautas_Click of VBA Document Form_TurmasConstituicaoDe"

End Sub

==========================

It works OK but I have a problem: people can 'travel' above the '2009'
folder and from them to other child folders.

Is there a way to say 'clip' the access to parent folders? If not, Is
there some other method to get the required result?

Thanks
H. Martins

Hi,
you can use a normal windows file dialog!
I use the filedialog from Karsten Pries (http://www.kpries.de/)
or try the example from Stephan Lebans (http://www.lebans.com/callbackbrowser.htm).

regards
Stefan Schulte-Kellinghaus
 
Back
Top