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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a folder using VBA

Status
Not open for further replies.

alrandal

Programmer
Oct 1, 2002
27
US
I have an access database that I would like to connect to a folder on a server. Is there code that I can add to the onClick procedure of a command button on a form to go out to a server and open the specific folder?

Also this folder requires a name and password to access it.

All I want to do is get to the point to where the user will be putting his name and password in to access the folder.
 
Does this work -
'----------------------
ChDrive "MyFolder"
ChDir "MyFolder"
'---------------------- Regards
BrianB
** Let us know if you get something that works !
================================
 
I used the code in my form and it doesnt give me an error, but it doesnt do anything at all. It just sits there.
 
1. Presumably you hae dome something like :
Myfolder= "C:\Temp" first.

2. You are right. It doesn't do much other than reset the current local folder. This means that all files are saved and accessed here without having to put the full path. If you run this and, from the File menu try File Save As ..... you will see what I mean.

You stated that you wanted to <<to go out to a server and open the specific folder>>. This is the code that does that.


Regards
BrianB
** Let us know if you get something that works !
================================
 
Ok I used the code and I see what you are saying, the code does open the folder in the background so that you can search the folder. But this is not what I want to accomplish, I actually want to be able to visually watch the folder open. This folder requires a name and password to access it. I would like to have the menu pop up to enter your name and password. Also remember Im using VBA.
Thanks for your help Brian.
 
But THEN what do you want to do, when the folder contents are displayed? Select a file? It sounds like you may need the

Application.GetSaveasFilename
or
Application.GetOpenFilename

methods. They both take a full pathname as a parameter, so you can open any folder (including network folders, which you can't get to with ChDir and ChDrive, if they are not mapped to a drive letter).
Rob
 
Ok guys thanks for all you help, but I went with the &quot;shell&quot; path and it works great.

Shell &quot;C:\WINDOWS\EXPLORER.EXE &quot; & &quot;\\PATH\&quot; _
, vbMaximizedFocus

Not sure if you understood what I wanted but this is the code for any future references
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top