Open Folder on Network via Command Button

G

Guest

I have a form which displays a single record with a single field [SKU] at a
time. On this form, I have a command button, which on a click, I would like
for it to open a folder on our company's network. For example, if [SKU] =
C100 on the current record, I would like to build some code so that if a
person pushes the command button, windows will automatically open the folder
Z:\XXXX\XXX\XXX\C100 and display its contents. Please help!
 
T

Tim Ferguson

For example, if [SKU] =
C100 on the current record, I would like to build some code so that if
a person pushes the command button, windows will automatically open
the folder Z:\XXXX\XXX\XXX\C100 and display its contents. Please
help!

' get the full path, remember the \ at the end
' if you need to make this OS independent, use the
' Application.PathSeparator inbuilt
'
strPath = "z:\XXX\XXX\XXX\" & me!SKU & "\"

' now call the Windows Explorer; don't forget the space in the
' middle!
Shell "explorer.exe " & strPath

Hope that helps


Tim F
 
G

Guest

Thanks, Tim. It worked beautifully!

Tim Ferguson said:
For example, if [SKU] =
C100 on the current record, I would like to build some code so that if
a person pushes the command button, windows will automatically open
the folder Z:\XXXX\XXX\XXX\C100 and display its contents. Please
help!

' get the full path, remember the \ at the end
' if you need to make this OS independent, use the
' Application.PathSeparator inbuilt
'
strPath = "z:\XXX\XXX\XXX\" & me!SKU & "\"

' now call the Windows Explorer; don't forget the space in the
' middle!
Shell "explorer.exe " & strPath

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top