?
Solved

Open Folder using explorer

Posted on 2009-04-29
4
Medium Priority
?
358 Views
Last Modified: 2012-06-21
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?
0
Comment
Question by:correlate
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 24262628


place this in the click event of the button

dim spath as string
spath="U:\CDG\CDG\Members Folders\[First Name] & "-" &[Last Name]& "-" & [ID]"

followhyperlink sPath
0
 
LVL 11

Expert Comment

by:SeanStrickland
ID: 24262641
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
0
 
LVL 75
ID: 24262649
Here is the generic Shell:

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

mx
0
 

Author Closing Comment

by:correlate
ID: 31576045
Perfect thank you,
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question