Solved Open a folder based on record number

Mcgregorbart

New member
Local time
Today, 20:55
Joined
Jul 30, 2010
Messages
11
Help if possible please probably will seem basic to most.
I have a form with a command button programmed to open a folder on my network. this folder contains a folder for each record where I store files relating to a given record. This button works fine opens explorer and displays all my sub folders. What I would like it to do is open the folder that pertains to the record that I am viewing. I want it to pick up the NC Number field which is the unique record for each folder also. VBA code I have currently is

Private Sub Command12478_Click()
On Error GoTo Err_cmdExplore_Click

Dim stAppName As String

stAppName = "C:\Windows\explorer.exe F:\Rec Work\NON CONFORMANCE ATTACHMENTS"
Call Shell(stAppName, 1)

Exit_cmdExplore_Click:
Exit Sub

Err_cmdExplore_Click:
MsgBox Err.Description
Resume Exit_cmdExplore_Click

End Sub

Any help would be appreciated tyia
 

Attachments

  • Capture.PNG
    Capture.PNG
    56.4 KB · Views: 179
So you would append the NCNUmber control value to the existing string.
Debug.Print it before you try and use it. That way you will see if it is correct or not.

Likely all you need is
Code:
stAppName = "C:\Windows\explorer.exe F:\Rec Work\NON CONFORMANCE ATTACHMENTS\" & Me.NCNumber
 
So you would append the NCNUmber control value to the existing string.
Debug.Print it before you try and use it. That way you will see if it is correct or not.

Likely all you need is
Code:
stAppName = "C:\Windows\explorer.exe F:\Rec Work\NON CONFORMANCE ATTACHMENTS\" & Me.NCNumber
I am thinking possibly some more quotes due to the space in folder path name...maybe?
 
I am thinking possibly some more quotes due to the space in folder path name...maybe?
Well to me, a number is a number?
Then again that is just me? :(
 
Well the O/P said that part was working, so I thought they just need to append the NCnumber
 
So you would append the NCNUmber control value to the existing string.
Debug.Print it before you try and use it. That way you will see if it is correct or not.

Likely all you need is
Code:
stAppName = "C:\Windows\explorer.exe F:\Rec Work\NON CONFORMANCE ATTACHMENTS\" & Me.NCNumber
Thank you just had to add underscore NC_Number (forgot about space.) works like a charm cheers
 

Users who are viewing this thread

Back
Top Bottom