Shell command help... I think!

golferbabe38

Registered User.
Local time
Today, 10:39
Joined
Sep 17, 2007
Messages
19
Hey everyone :)

Need some help with my first shell command. I'm close, but no cigar.

I have a form in access and have inserted a command button labeled "Folder". I would like the users to be able to click this Folder button and have the corresponding file open from a folder on the server. The file name will be the same as the data entered in the PatientName field in the form.
Example: Data in the Patient Name field: Doe, John
File housed in folder on the server: Doe, John

Thus far, I am able to open the explorer window, but it opens to My Documents instead of the Foldername path I have below. Any help would be appreciated. Thanks!

Sub Folder_Click()

Dim Foldername As String

Foldername = "V:\EMA Shared\Legal\Records Requests\" & PatientName.Value

Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus

End Sub
 
If you're opening a file, I'd look at FollowHyperlink instead of Shell.
 
I just created a quick database and this is how I did what you're asking to do:

Dim foldername As String
foldername = "j:\ema shared\legal\records request\"
Shell "c:\windows\explorer.exe " & foldername & Me.patientname, vbNormalFocus

Since my data all resides on J: drive, just substitute your information where you see mine. Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom