Link to home
Start Free TrialLog in
Avatar of Tom Crowfoot
Tom CrowfootFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Open Folder using explorer

Hi Experts

I am running access 2003 and have a form which I want to add a command button to that opens up a folder (using explorer).  

The file path for the folder will change from record to record.  But as part of the set up process for each record, a folder is created in the following filepath U:\CDG\CDG\Members Folders\ & then has a sub folder derived using the following naming protocol [First Name]-[Last Name]-[ID] (i.e. Dave-Smith-123)

So the link piece to the code would be U:\CDG\CDG\Members Folders\[First Name] & "-" &[Last Name]& "-" & [ID]

Has anyone got a piece of code to do this or can anyone help?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The code to simply open a folder using explorer is:

Application.FollowHyperlink "U:\CDG\CDG\Members Folders\"

The rest can be achieved by cycling through or looking at a recordset to gather and concatenate the first/last name and IDs to create the entire folder location (assuming this is available in a table or query).

Hope that helps,
Sean
Here is the generic Shell:

Shell "explorer.exe  U:\CDG\CDG\Members Folders\", vbNormalFocus

mx
Avatar of Tom Crowfoot

ASKER

Perfect thank you,