dbTalk Databases Forums  

what the...?

comp.databases.ms-access comp.databases.ms-access


Discuss what the...? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
5p1der@centurytel.net
 
Posts: n/a

Default what the...? - 01-03-2005 , 11:51 AM






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


Reply With Quote
  #2  
Old   
PC Datasheet
 
Posts: n/a

Default Re: what the...? - 01-03-2005 , 12:29 PM






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
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


<5p1der (AT) centurytel (DOT) net> wrote

Quote:
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




Reply With Quote
  #3  
Old   
5p1der@centurytel.net
 
Posts: n/a

Default Re: what the...? - 01-03-2005 , 03:27 PM



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.


Reply With Quote
  #4  
Old   
PC Datasheet
 
Posts: n/a

Default Re: what the...? - 01-03-2005 , 03:39 PM



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
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


<5p1der (AT) centurytel (DOT) net> wrote

Quote:
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.




Reply With Quote
  #5  
Old   
5p1der@centurytel.net
 
Posts: n/a

Default Re: what the...? - 01-03-2005 , 03:54 PM



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?


Reply With Quote
  #6  
Old   
PC Datasheet
 
Posts: n/a

Default Re: what the...? - 01-03-2005 , 04:54 PM



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)




<5p1der (AT) centurytel (DOT) net> wrote

Quote:
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?




Reply With Quote
  #7  
Old   
Trevor Best
 
Posts: n/a

Default Re: what the...? - 01-04-2005 , 05:25 AM



5p1der (AT) centurytel (DOT) net wrote:
Quote:
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


Reply With Quote
  #8  
Old   
5p1der@centurytel.net
 
Posts: n/a

Default Re: what the...? - 01-04-2005 , 11:40 AM



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.


Reply With Quote
  #9  
Old   
5p1der@centurytel.net
 
Posts: n/a

Default Re: what the...? - 01-04-2005 , 12:36 PM



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


Reply With Quote
  #10  
Old   
Trevor Best
 
Posts: n/a

Default Re: what the...? - 01-04-2005 , 06:47 PM



5p1der (AT) centurytel (DOT) net wrote:
Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.