469,275 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Shell command and File Not Found

Im using the following code to open a second access database:

Dim stAppName As String
Dim retVal As Integer

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
retVal = Shell(stAppName, 1)

and access returns an error of File Not Found. I tried the following
variation with the same result:

Dim stAppName As String
stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" &_
"C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "msaccess.exe" & Chr(34) & "C:\PlantManager\Plants.mdb" &
Chr(34)
Call Shell(stAppName, 1)

any thoughts
Feb 18 '07 #1
7 14028
On Feb 17, 7:58 pm, "Jimmy" <d...@email.mewrote:
Im using the following code to open a second access database:

Dim stAppName As String
Dim retVal As Integer

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
retVal = Shell(stAppName, 1)

and access returns an error of File Not Found. I tried the following
variation with the same result:

Dim stAppName As String
stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" &_
"C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "msaccess.exe" & Chr(34) & "C:\PlantManager\Plants.mdb" &
Chr(34)
Call Shell(stAppName, 1)

any thoughts
Thought1:
Shell SysCmd(acSysCmdAccessDir) & "MsAccess.Exe " _
& """C:\Documents and Settings\Lyle Fairfield\My Documents\Access
\northwind.mdb"""

Thought2:
Dim a As Access.Application

Sub temp()
Set a = New Access.Application
With a
.OpenCurrentDatabase "C:\Documents and Settings\Lyle Fairfield\My
Documents\Access\northwind.mdb"
.Visible = True
End With
End Sub

Sub Later()
If Not a Is Nothing Then
a.Quit
Set a = Nothing
End If
End Sub

Thought3:
When you tell why sometimes there are better ways suggested.
Feb 18 '07 #2
On Feb 17, 7:58 pm, "Jimmy" <d...@email.mewrote:
Im using the following code to open a second access database:

Dim stAppName As String
Dim retVal As Integer

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
retVal = Shell(stAppName, 1)

and access returns an error of File Not Found. I tried the following
variation with the same result:

Dim stAppName As String
stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" &_
"C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "msaccess.exe" & Chr(34) & "C:\PlantManager\Plants.mdb" &
Chr(34)
Call Shell(stAppName, 1)

any thoughts
http://www.m-w.com/dictionary/Isthisatrickquestion?

The word you've entered isn't in the dictionary. Click on a spelling
suggestion below or try again using the search bar above.

Suggestions for isthisatrickquestion?:
1. aesthetic distance
2. East Stroudsburg
3. aussitot dit, aussitot fait

..exe "

James A. Fortune
CD********@FortuneJames.com

Feb 18 '07 #3
Hi, Jimmy.
any thoughts
This line of code concatenates two strings together:

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"

After it executes the stAppName variable contains
"msaccess.exeC:\PlantManager\Plants.mdb" -- so look at it a little closer,
and tell me why your operating system can't find a file on the
msaccess.exeC:\ drive.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"Jimmy" <do**@email.mewrote in message
news:9x****************@fe01.news.easynews.com...
Im using the following code to open a second access database:

Dim stAppName As String
Dim retVal As Integer

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
retVal = Shell(stAppName, 1)

and access returns an error of File Not Found. I tried the following
variation with the same result:

Dim stAppName As String
stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe"
&_
"C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "msaccess.exe" & Chr(34) & "C:\PlantManager\Plants.mdb" &
Chr(34)
Call Shell(stAppName, 1)

any thoughts

Feb 18 '07 #4

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote in
message news:12*************@corp.supernews.com...
This line of code concatenates two strings together:

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
stAppName = "msaccess.exe C:\PlantManager\Plants.mdb"

works like a charm!
Feb 18 '07 #5
What?

<CD********@FortuneJames.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
On Feb 17, 7:58 pm, "Jimmy" <d...@email.mewrote:
>Im using the following code to open a second access database:

Dim stAppName As String
Dim retVal As Integer

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
retVal = Shell(stAppName, 1)

and access returns an error of File Not Found. I tried the following
variation with the same result:

Dim stAppName As String
stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe"
&_
"C:\PlantManager\Plants.mdb"
Call Shell(stAppName, 1)

Dim stAppName As String
stAppName = "msaccess.exe" & Chr(34) & "C:\PlantManager\Plants.mdb" &
Chr(34)
Call Shell(stAppName, 1)

any thoughts

http://www.m-w.com/dictionary/Isthisatrickquestion?

The word you've entered isn't in the dictionary. Click on a spelling
suggestion below or try again using the search bar above.

Suggestions for isthisatrickquestion?:
1. aesthetic distance
2. East Stroudsburg
3. aussitot dit, aussitot fait

.exe "

James A. Fortune
CD********@FortuneJames.com

Feb 18 '07 #6
Hi, Jimmy.
stAppName = "msaccess.exe C:\PlantManager\Plants.mdb"

works like a charm!
Good job!

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"Jimmy" <do**@email.mewrote in message
news:ZP********************@fe08.news.easynews.com ...
>
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote
in message news:12*************@corp.supernews.com...
>This line of code concatenates two strings together:

stAppName = "msaccess.exe" & "C:\PlantManager\Plants.mdb"

stAppName = "msaccess.exe C:\PlantManager\Plants.mdb"

works like a charm!

Feb 18 '07 #7
On Feb 18, 1:24 pm, "Jimmy" <d...@email.mewrote:
What?
Exactly. The point was to show you, from Access' perspective, what
you did. Access was forced to say, "What?" because of the missing
space. If you have a space in the path be sure to find a way to
include double quotes as shown by Lyle or your example containing
Chr(34). Explaining it detracts from the total effect though.

James A. Fortune
CD********@FortuneJames.com

Feb 19 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Yann.K | last post: by
10 posts views Thread by Siemel Naran | last post: by
8 posts views Thread by zhiwei wang | last post: by
2 posts views Thread by jcrouse | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.