By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

what the...?

P: n/a
I am using the following in A2k on a Win2k (SP4) Terminal Server using
a SQL 7 backend.

Private Sub EOLDirectory_Click()
Dim SrDir, SRval
SRval = Left(Me!SR, Len(Me!SR) - 4)
SrDir = Shell("explorer \\MyServ\shares\eol\" & SRval & "0000-" & SRval
& "9999\", 1)
End Sub

Some folks use a copy of the db from terminal services, others use it
from their local desktop, but all working files and directories are on
a shared drive on the network. The directory opens just fine, but the
db reports 'Unable to open "\\MyServ\shares\eol\". Cannot open the
specified file.' I have tried to format the shell() argument several
different ways and get the same results, including:

SiteDir = Shell("c:\windows\explorer.exe" & Chr(32) & Chr(34) &
"\\oflnmoejfs1\shares\EOL\" & SRval & "0000-" & SRval & "9999", 1)

Can someone help me understand why I am getting the error? This seems
straightforward, and other postings on opening folders do not seem to
discuss this error. TIA

Nov 13 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
It looks like you do not include the extension in your file name.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<5p****@centurytel.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am using the following in A2k on a Win2k (SP4) Terminal Server using
a SQL 7 backend.

Private Sub EOLDirectory_Click()
Dim SrDir, SRval
SRval = Left(Me!SR, Len(Me!SR) - 4)
SrDir = Shell("explorer \\MyServ\shares\eol\" & SRval & "0000-" & SRval
& "9999\", 1)
End Sub

Some folks use a copy of the db from terminal services, others use it
from their local desktop, but all working files and directories are on
a shared drive on the network. The directory opens just fine, but the
db reports 'Unable to open "\\MyServ\shares\eol\". Cannot open the
specified file.' I have tried to format the shell() argument several
different ways and get the same results, including:

SiteDir = Shell("c:\windows\explorer.exe" & Chr(32) & Chr(34) &
"\\oflnmoejfs1\shares\EOL\" & SRval & "0000-" & SRval & "9999", 1)

Can someone help me understand why I am getting the error? This seems
straightforward, and other postings on opening folders do not seem to
discuss this error. TIA

Nov 13 '05 #2

P: n/a
I should have explained better. The folder path I am trying to open is
a function of the SR value minus the last 4 digits. My understanding
is to use explorer to open a folder. Yet I am getting a file error
when opening a folder.

Nov 13 '05 #3

P: n/a
If you have a database named MyDatabase, the fully qualified file name is
MyDatabase.mdb. mdb is the extension. From this example, your code is
missing the ".mdb" and therefore when you try and open the file you get an
error.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<5p****@centurytel.net> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
I should have explained better. The folder path I am trying to open is
a function of the SR value minus the last 4 digits. My understanding
is to use explorer to open a folder. Yet I am getting a file error
when opening a folder.

Nov 13 '05 #4

P: n/a
There is no file. The database contains a form which has a button that
is calling explorer to open a specific directory. Nothing more,
nothing less. The folder that needs to open is variable by the SR
value. Other postings show the shell() function calling explorer as
being the means by which to open a folder. Opening a file is beyond
the scope of this request for assistance. Since the function calls a
directory, and that directory opens as it should, why do I get a file
error, when no file is being requested?

Nov 13 '05 #5

P: n/a
Perhaps the Dir function is more what you need ---
From the Help file ---
This example uses the Dir function to check if certain files and directories
exist.
Dim MyFile, MyPath, MyName
' In Microsoft Windows:
' Returns "WIN.INI" if it exists.
MyFile = Dir("C:\WINDOWS\WIN.INI")

' Returns filename with specified extension. If more than one *.ini
' file exists, the first file found is returned.
MyFile = Dir("C:\WINDOWS\*.INI")

' Call Dir again without arguments to return the next *.INI file in the
' same directory.
MyFile = Dir

' Return first *.TXT file with a set hidden attribute.
MyFile = Dir("*.TXT", vbHidden)


<5p****@centurytel.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
There is no file. The database contains a form which has a button that
is calling explorer to open a specific directory. Nothing more,
nothing less. The folder that needs to open is variable by the SR
value. Other postings show the shell() function calling explorer as
being the means by which to open a folder. Opening a file is beyond
the scope of this request for assistance. Since the function calls a
directory, and that directory opens as it should, why do I get a file
error, when no file is being requested?

Nov 13 '05 #6

P: n/a
5p****@centurytel.net wrote:
I am using the following in A2k on a Win2k (SP4) Terminal Server using
a SQL 7 backend.

Private Sub EOLDirectory_Click()
Dim SrDir, SRval
SRval = Left(Me!SR, Len(Me!SR) - 4)
SrDir = Shell("explorer \\MyServ\shares\eol\" & SRval & "0000-" & SRval
& "9999\", 1)
End Sub

Some folks use a copy of the db from terminal services, others use it
from their local desktop, but all working files and directories are on
a shared drive on the network. The directory opens just fine, but the
db reports 'Unable to open "\\MyServ\shares\eol\". Cannot open the
specified file.' I have tried to format the shell() argument several
different ways and get the same results, including:

SiteDir = Shell("c:\windows\explorer.exe" & Chr(32) & Chr(34) &
"\\oflnmoejfs1\shares\EOL\" & SRval & "0000-" & SRval & "9999", 1)

Can someone help me understand why I am getting the error? This seems
straightforward, and other postings on opening folders do not seem to
discuss this error. TIA


Have you tried:
SrDir = Shell("explorer ""\\MyServ\shares\eol\" & SRval & "0000-" &
SRval & "9999\""", 1)

Usually, any path that has spaces should be enclosed in quotes for any
DOS to understand.

--
This sig left intentionally blank
Nov 13 '05 #7

P: n/a
Thanks, Chuck. I'm a part timer, and this is over my head. But, since
you brought it up, i do have a question because not being a programmer,
it just does not make sense to me: how is using 3 lines silly compared
to the 35 in the api? This is a serious question--not a smart ass--i
just don't get it. this would seem to contradict the idea of
efficiency, less chance of error, etc.

Nov 13 '05 #8

P: n/a
Thanks, trevor. same thing, opens the directory, but still get file
error. is there a way to make it ignore the error?

Nov 13 '05 #9

P: n/a
5p****@centurytel.net wrote:
Thanks, trevor. same thing, opens the directory, but still get file
error. is there a way to make it ignore the error?


Sendkeys "{ESC}" <grin>

Have a search for ShellExecute API call, there's many examples for VB
usage, then use that to execute the directory (it will use explorer as
default, assuming that is the registered app for folders).

--
This sig left intentionally blank
Nov 13 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.