Frankie_The_Flyer
Registered User.
- Local time
- Tomorrow, 03:11
- Joined
- Aug 16, 2013
- Messages
- 39
I'm still very new to this game and have been searching the Internet for bits and peices that I then build into something that generally works!
I'm now attempting to use a button on a form to open a sub-folder that is held in My Documents folder, "Customers".
The Sub-folder name is that of the customer as displayed on the form in the cell named "Entity"
Unfortunately as the name of the customer in the Entity cell may differ from that of the folder (could have the Pty or Ltd missing off the folder name).
I want the process to either open the folder if it's correctly named, or open the main folder if it isnt, so the user can search for the folder.
So far I have the following which will do the task but has a couple of issues.
1. it always brings up the warning "Path or File name is not found" if the folder is incorrectly named
2. If the folder is correctly named it not only opens the folder for the customer named in Entity, but goes on to open the "Customer" folder too.
Questions:
What code do I need to make the process open the folder for the Entity if the name in Entity and the name on the folder match; Or open the folder "Customer" if the name of the Entity and the name on the folder don't match?
Is there any way I can turn off the "Path or File Name" warning? (DoCmd doesn't seem to work)
Code I have is as follows
rivate Sub Command217_Click()
sPath = [Entity]
DoCmd.SetWarnings False
Shell "Explorer.exe " & "C:\Mydocuments\Customers\" & sPath, vbNormalFocus
If NotFound Then
Shell "Explorer.exe " & ""C:\Mydocuments\Customers\", vbNormalFocus
Else
Shell "Explorer.exe " & "C:\Mydocuments\Customers\" & sPath, vbNormalFocus
End If
DoCmd.SetWarnings True
End Sub
I'm now attempting to use a button on a form to open a sub-folder that is held in My Documents folder, "Customers".
The Sub-folder name is that of the customer as displayed on the form in the cell named "Entity"
Unfortunately as the name of the customer in the Entity cell may differ from that of the folder (could have the Pty or Ltd missing off the folder name).
I want the process to either open the folder if it's correctly named, or open the main folder if it isnt, so the user can search for the folder.
So far I have the following which will do the task but has a couple of issues.
1. it always brings up the warning "Path or File name is not found" if the folder is incorrectly named
2. If the folder is correctly named it not only opens the folder for the customer named in Entity, but goes on to open the "Customer" folder too.
Questions:
What code do I need to make the process open the folder for the Entity if the name in Entity and the name on the folder match; Or open the folder "Customer" if the name of the Entity and the name on the folder don't match?
Is there any way I can turn off the "Path or File Name" warning? (DoCmd doesn't seem to work)
Code I have is as follows
rivate Sub Command217_Click()
sPath = [Entity]
DoCmd.SetWarnings False
Shell "Explorer.exe " & "C:\Mydocuments\Customers\" & sPath, vbNormalFocus
If NotFound Then
Shell "Explorer.exe " & ""C:\Mydocuments\Customers\", vbNormalFocus
Else
Shell "Explorer.exe " & "C:\Mydocuments\Customers\" & sPath, vbNormalFocus
End If
DoCmd.SetWarnings True
End Sub