Have created a bit of code so when a user clicks on a button it open Explorer in the correct folder location, here's my code:
Private Sub Cmd_OpenExp_MEDLoc_Click()
Dim ProjPath
ProjPath = "G:\MED Data\" & Me.MED_FolderLink.Value
Shell "C:\WINDOWS\explorer.exe """ & ProjPath & "", vbNormalFocus
End Sub
MED_FolderLink is a field into which the user puts the end of the folder location. However, it's kinda redundant as there is another field in the form which represents the first couple of characters of the folder. So ideally I'd like the code to look something like this:
Private Sub Cmd_OpenExp_MEDLoc_Click()
Dim ProjPath
ProjPath = "G:\MED Data\" & Me.PR_NO.Value
Shell "C:\WINDOWS\explorer.exe """ & ProjPath & "*" & "", vbNormalFocus
End Sub
Of course it doesn't like the "*" and returns a directory not found message.
Is there any way of making the code above work? The PR_NO value might look something like
PR 0673
while the folder reference might look like
G:\MED Data\PR 0673 Parara-1
They're essentially the same though, but without manually inputting the folder path there seems to be no way around it.
Any help would be appreciated
Private Sub Cmd_OpenExp_MEDLoc_Click()
Dim ProjPath
ProjPath = "G:\MED Data\" & Me.MED_FolderLink.Value
Shell "C:\WINDOWS\explorer.exe """ & ProjPath & "", vbNormalFocus
End Sub
MED_FolderLink is a field into which the user puts the end of the folder location. However, it's kinda redundant as there is another field in the form which represents the first couple of characters of the folder. So ideally I'd like the code to look something like this:
Private Sub Cmd_OpenExp_MEDLoc_Click()
Dim ProjPath
ProjPath = "G:\MED Data\" & Me.PR_NO.Value
Shell "C:\WINDOWS\explorer.exe """ & ProjPath & "*" & "", vbNormalFocus
End Sub
Of course it doesn't like the "*" and returns a directory not found message.
Is there any way of making the code above work? The PR_NO value might look something like
PR 0673
while the folder reference might look like
G:\MED Data\PR 0673 Parara-1
They're essentially the same though, but without manually inputting the folder path there seems to be no way around it.
Any help would be appreciated