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

Upload function to show path to folder rather than the individual file 1

Status
Not open for further replies.

tontenn

Vendor
Dec 29, 2006
54
AU
Hi Guys

In reference to thread702-1336538

Aceman gave me the code

Me!Path = LaunchCD (Me)

to throw a path into a text box so that staff can click and be taken straight to a file on the server.
Now that has been working like a dream and its so good and saved so much time but the issue we are having is that it will throw a path to a specific file, but when we just want it to open a folder it wont let us do it.

Can anyone suggest a way to change the code so it opens folder as well or a separate code just for folders.

Help would be greatly appreciated.

Cheers

Tones
 
a separate code just for folders
Here a function I've already posted:
Code:
Function PickFolder(strStartDir As Variant) As String
Dim SA As Object, f As Object
Set SA = CreateObject("Shell.Application")
Set f = SA.BrowseForFolder(0, "Choose a folder", 16, strStartDir)
If (Not f Is Nothing) Then
  PickFolder = f.Items.Item.path
End If
Set f = Nothing
Set SA = Nothing
End Function

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH

But do I need to add or change anything to make it suit my form as it came up with an error message once I pressed it.

"Ambiguous Name Detected: PickFolder"

I may have done something wrong.

Cheers
Tones
 
You already have a function or something else named PickFolder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok PHV Im really confused

Let me tell you what I did.

I added the code that you gave me to the "Event Procedure" section of the properties of the button to send the path to the path text box.

Is that where it is supposed to go or should it be in some other part of the database first before I call it to run on the form.

Your help would be greatly appreciated

Cheers
Tones
 
I'd put the code in a standard code module.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok and how do I make that module work from a button on my form.

Have never used a module before.
 
A starting point:
[yourTextBox].Value = PickFolder("\path\to\rootfolder")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Oh PH

Thats awesome. Just what the doctor ordered.

Thank you so much.

Cheers
Tones
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top