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

Shell command and File Not Found

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"'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

P: n/a
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

P: n/a
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

P: n/a
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.