Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Shell Function


Message #1 by "Alankar Trivedi" <alankar.trivedi@i...> on Thu, 19 Sep 2002 10:16:22
Hi,

I am using the shell function available in access and i have the following 
code

LocalApp = "C:\Program Files\EventManagement1\EventManagement1.mdb"
LocalFileName = "EventManagement1.mdb"
strsecurityfile = "L:\IBBApps\Event Management\Security\secured.mdw"
strAccessPath = "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"

strShellPath = strAccessPath & " " & strLocalApp & " /wrkgrp" & 
strsecurityfile

The problem i am having is it is not recognising my strLocalApp as the 
full path and keeps reading it as "C:\Program.mdb" and with this happening 
the application obviously will not start cause that isnt the application 
name.

any ideas?
Message #2 by "Gregory Serrano" <SerranoG@m...> on Thu, 19 Sep 2002 20:43:52
Alankar,

<< LocalApp = "C:\Program Files\EventManagement1\EventManagement1.mdb"

[snip]

The problem i am having is it is not recognising my strLocalApp as the 
full path and keeps reading it as "C:\Program.mdb" and with this happening 
the application obviously will not start cause that isnt the application 
name. >>

Well, first thing... did you notice that your code has "LocalApp" as the 
variable name but your paragraph talks about an "strLocalApp"?  Did you 
forget the "str" in your code for "strLocalApp"?

Greg
Message #3 by "Wayne Ryan" <wayne.ryan@t...> on Thu, 19 Sep 2002 21:09:17
Alankar,

I recall doing this a while ago.

I think the app name must be last.

strShellPath = strAccessPath & " /wrkgrp " & strsecurityfile & _
               " " & strLocalApp 

HTH,
Wayne
Message #4 by "Wayne Ryan" <wayne.ryan@t...> on Thu, 19 Sep 2002 22:49:28
Alankar,

Hi, sat down and tried to run it and have further input

Dim Temp As Long   '  Not integer

'
' This works fine
'
strLocalApp = "C:\EFSFY02\EFS.mdb"
strsecurityfile = "C:\windows\system\system.mdw"  ' no spaces ...
strAccessPath = "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
strShellPath = strAccessPath & " /wrkgrp " & strsecurityfile & _
              " " & strLocalApp
Temp = Shell(strShellPath, vbNormalFocus)

'
' This doesn't
'
strLocalApp = "C:\EFSFY02\EFS.mdb"
strsecurityfile = "C:\Program Files\Microsoft Office\system.mdw"
strAccessPath = "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
strShellPath = strAccessPath & " /wrkgrp " & strsecurityfile & _
              " " & strLocalApp
Temp = Shell(strShellPath, vbNormalFocus)

I think the space in the path for the system.mdw file is confusing
issues.  It says it can't open Program.mdb

Good Luck,
Wayne
Message #5 by "Gerald, Rand" <RGerald@u...> on Thu, 19 Sep 2002 18:00:29 -0500
Re: This doesn't work:

strShellPath =3D strAccessPath & " /wrkgrp " & strsecurityfile & _
              " " & strLocalApp

Try modifying it as follows:

strShellPath =3D strAccessPath & " /wrkgrp " & Chr(34) & 
strsecurityfile & _
              Chr(34) & " " & strLocalApp

Note: the Chr(34) is a doublequote.


Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Wayne Ryan [mailto:wayne.ryan@t...]
Sent: Thursday, September 19, 2002 5:49 PM
To: Access
Subject: [access] Re: Shell Function

Alankar,

Hi, sat down and tried to run it and have further input

Dim Temp As Long   '  Not integer

'
' This works fine
'
strLocalApp =3D "C:\EFSFY02\EFS.mdb"
strsecurityfile =3D "C:\windows\system\system.mdw"  ' no spaces ...
strAccessPath =3D "C:\Program Files\Microsoft 
Office\Office\MSACCESS.EXE"
strShellPath =3D strAccessPath & " /wrkgrp " & strsecurityfile & _
              " " & strLocalApp
Temp =3D Shell(strShellPath, vbNormalFocus)

'
' This doesn't
'
strLocalApp =3D "C:\EFSFY02\EFS.mdb"
strsecurityfile =3D "C:\Program Files\Microsoft Office\system.mdw"
strAccessPath =3D "C:\Program Files\Microsoft 
Office\Office\MSACCESS.EXE"
strShellPath =3D strAccessPath & " /wrkgrp " & strsecurityfile & _
              " " & strLocalApp
Temp =3D Shell(strShellPath, vbNormalFocus)

I think the space in the path for the system.mdw file is confusing
issues.  It says it can't open Program.mdb

Good Luck,
Wayne
Message #6 by "Wayne Ryan" <wayne.ryan@t...> on Fri, 20 Sep 2002 20:14:00
Thanks Gerald,

My prior usage of the Shell function never had spaces in
the arguments.

I take this to mean that the Chr(34) is only "required" if
your argument has an embedded space?  Odd, because that
doesn't seem to be true for the application argument.

Thanks, I hope the original poster got your help.

Wayne
Message #7 by "Gerald, Rand" <RGerald@u...> on Fri, 20 Sep 2002 17:07:17 -0500
You are correct, the Chr(34) is only "required" if the argument has 
spaces,
however it will work even if the argument does not have spaces.  When 
in
doubt, use the Chr(34)'s.  It doesn't hurt.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Wayne Ryan [mailto:wayne.ryan@t...]
Sent: Friday, September 20, 2002 3:14 PM
To: Access
Subject: [access] Re: Shell Function

Thanks Gerald,

My prior usage of the Shell function never had spaces in
the arguments.

I take this to mean that the Chr(34) is only "required" if
your argument has an embedded space?  Odd, because that
doesn't seem to be true for the application argument.

Thanks, I hope the original poster got your help.

Wayne

  Return to Index