Opening a Folder form Access

Studenn

Registered User.
Local time
Today, 18:38
Joined
Dec 24, 2004
Messages
13
I need some help with something I presumed would be easy.

I want to be able to open a named folder using a command button on a form The name of the folder is to be linked to a field on the open form. e.g. I've folders for clients in which I store letters etc. I want to open this folder in list form directly from an the access record form for that individual. Would it also be posssible to scan documents to the same file. at the press of a button.

Any help would be greatly appreceiated.
 
Studenn,

Use the Search Facility here and look for "Browse". You should find some
excellent examples by ghudson.

Wayne
 
Opening a folder from Access

Cracked it! Thanks Wayne.
 
Help with macimising folder window.

Thanks for all the help so far.

Although I have designed and use a number of databases this has all been done very successfully using very little code.

I have used the following to open a named folder from a command button on an access form. The window opens minimised, Have searched the forum and see that I need to specify a second argument in the shell statement. - I cant get it to work.

Can anyone help please. My code so far is:-

Private Sub Command165_Click()



Dim xPath, xFolder, xCmd As String

xPath = "C:\Documents and Settings\admin\My Documents\folder\"

xFolder = xPath & Me![ClientName]
' (MkDir xFolder ' create folder )
xCmd = "explorer.exe " & xFolder & "\" ' open folder
Shell (xCmd)
Quote:
End Sub
 
Try the ShellExecute API.

A nice and handy wrapper that can be copied into a new standard module can be found here:
http://www.mvps.org/access/api/api0018.htm

Call it like this:

call fhandlefile(xpath, WIN_MAX)

Else, I think the Shell should work using something like this:

Shell (xCmd,vbMaximizedFocus)
 
Thanks Roy & Wayne

After a lot of trial and error following code works fine:-
Private Sub Command165_Click()

Dim xPath, xFolder, xCmd, Result As String

xPath = "C:\Documents and Settings\admin\My Documents\folder\"

xFolder = xPath & Me![ClientName]
' (MkDir xFolder ' create folder )

xCmd = "explorer.exe " & xFolder & "\" ' open folder

Result = Shell (xCmd,vbNormalFocus)

Quote:

End Sub

Clearly I need to improve my coding skills any ideas/recommendations where to start?
 

Users who are viewing this thread

Back
Top Bottom