PC Review


Reply
Thread Tools Rate Thread

Command Line w/Unknown paths?

 
 
John G
Guest
Posts: n/a
 
      13th Mar 2009
Running MS Access 2003 on Windows XP
Is it possible to run a command line switch without knowing the exact paths?
The following command line works good as long as the files "Prg.mde" and
"secure.mdw" are in C:\Program Files\myFolder\.

Shell pathname:=("""C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
""C:\Program Files\myFolder\secure.mdw""")

I know that the files will be at "C:\Documents and
Settings\username\Application Data" (in Windows XP) but the username is
different on every computer. So if the exact path of files "PRG.mde" and
"secure.mdw" is not known; is there a way to use the following in the above
command line?

SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
Settings\username\Application Data" (in Windows XP) and returns
"C:\Users\username\AppData\Roaming" (in Windows Vista)
dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"

Thanks in advance.

John G
 
Reply With Quote
 
 
 
 
Pendragon
Guest
Posts: n/a
 
      13th Mar 2009
Do a search in this newsgroup for "Get computer names" or something to that
effect. Once you modify the code accordingly, you could set a string
variable to the username and create the full path and file name from there.

dim strCompName as string
dim strFilePathname as string

strCompName = {use the function you'll find in your search or use this
variable in that function to get the computer name}

strPathFileName = "C:\Program Files\" & strCompName & "\Prg.mde"

or however the full path and file name needs to read.

HTH!

"John G" wrote:

> Running MS Access 2003 on Windows XP
> Is it possible to run a command line switch without knowing the exact paths?
> The following command line works good as long as the files "Prg.mde" and
> "secure.mdw" are in C:\Program Files\myFolder\.
>
> Shell pathname:=("""C:\Program Files\Microsoft
> Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
> ""C:\Program Files\myFolder\secure.mdw""")
>
> I know that the files will be at "C:\Documents and
> Settings\username\Application Data" (in Windows XP) but the username is
> different on every computer. So if the exact path of files "PRG.mde" and
> "secure.mdw" is not known; is there a way to use the following in the above
> command line?
>
> SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
> Settings\username\Application Data" (in Windows XP) and returns
> "C:\Users\username\AppData\Roaming" (in Windows Vista)
> dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
> "C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"
>
> Thanks in advance.
>
> John G

 
Reply With Quote
 
John G
Guest
Posts: n/a
 
      13th Mar 2009
Chris,
Thanks for your reply.

However, ""%AppData%\myFolder\Prg.mde"" doesn't work. Error message says
"The command line you used to start Microsoft Office Access contains an
option that Microsoft Office Access doesn't recognize." "Exit and restart
Microsoft Office Access using valid command-line options."
I tried %AppData% & ""\myFolder\Prg.mde""
and ""%AppData% & \myFolder\Prg.mde""
and I have also tried ""%AppData%\myFolder\Prg.mde"".
How should I be using it? Maybe not enough quotes?

"Chris O'C via AccessMonster.com" wrote:

> Use environment variables. The built in environment variable you want is %
> AppData%. For Windows XP it returns
>
> {SystemDrive}:\Documents and Settings\{username}\Application Data
>
> For Vista and Windows 7 it returns
>
> {SystemDrive}:\Users\{username}\AppData\Roaming
>
> Example usage:
>
> %AppData%\myFolder\Prg.mde
>
> Chris
>
>
> John G wrote:
> >Running MS Access 2003 on Windows XP
> >Is it possible to run a command line switch without knowing the exact paths?
> >The following command line works good as long as the files "Prg.mde" and
> >"secure.mdw" are in C:\Program Files\myFolder\.
> >
> >Shell pathname:=("""C:\Program Files\Microsoft
> >Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
> >""C:\Program Files\myFolder\secure.mdw""")
> >
> >I know that the files will be at "C:\Documents and
> >Settings\username\Application Data" (in Windows XP) but the username is
> >different on every computer. So if the exact path of files "PRG.mde" and
> >"secure.mdw" is not known; is there a way to use the following in the above
> >command line?
> >
> >SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
> >Settings\username\Application Data" (in Windows XP) and returns
> >"C:\Users\username\AppData\Roaming" (in Windows Vista)
> >dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
> >"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"

>
> --
> Message posted via http://www.accessmonster.com
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      13th Mar 2009
While %AppData% works in BAT files, in VBA, you need to use the Environ
function:

Shell pathname:=("""C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE"" """ & Environ("AppData") & "\Prg.mde""
/WRKGRP
""" & Environ("AppData") & "\secure.mdw""")

Another alternative would be to use the code from
http://www.mvps.org/access/api/api0054.htm to determine the location.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
news:9308398baef8d@uwe...
> Use environment variables. The built in environment variable you want is
> %
> AppData%. For Windows XP it returns
>
> {SystemDrive}:\Documents and Settings\{username}\Application Data
>
> For Vista and Windows 7 it returns
>
> {SystemDrive}:\Users\{username}\AppData\Roaming
>
> Example usage:
>
> %AppData%\myFolder\Prg.mde
>
> Chris
>
>
> John G wrote:
>>Running MS Access 2003 on Windows XP
>>Is it possible to run a command line switch without knowing the exact
>>paths?
>>The following command line works good as long as the files "Prg.mde" and
>>"secure.mdw" are in C:\Program Files\myFolder\.
>>
>>Shell pathname:=("""C:\Program Files\Microsoft
>>Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde""
>>/WRKGRP
>>""C:\Program Files\myFolder\secure.mdw""")
>>
>>I know that the files will be at "C:\Documents and
>>Settings\username\Application Data" (in Windows XP) but the username is
>>different on every computer. So if the exact path of files "PRG.mde" and
>>"secure.mdw" is not known; is there a way to use the following in the
>>above
>>command line?
>>
>>SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
>>Settings\username\Application Data" (in Windows XP) and returns
>>"C:\Users\username\AppData\Roaming" (in Windows Vista)
>>dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
>>"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"

>
> --
> Message posted via http://www.accessmonster.com
>


 
Reply With Quote
 
John G
Guest
Posts: n/a
 
      14th Mar 2009
Thanks Doug!

I was trying to use SpecFolder(CSIDL_APPDATA) which I got from
http://www.mvps.org/access/api/api0054.htm but I didn't know how to use it in
the command line. See my first post.

John G

"Douglas J. Steele" wrote:

> While %AppData% works in BAT files, in VBA, you need to use the Environ
> function:
>
> Shell pathname:=("""C:\Program Files\Microsoft
> Office\OFFICE11\MSACCESS.EXE"" """ & Environ("AppData") & "\Prg.mde""
> /WRKGRP
> """ & Environ("AppData") & "\secure.mdw""")
>
> Another alternative would be to use the code from
> http://www.mvps.org/access/api/api0054.htm to determine the location.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
> "Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
> news:9308398baef8d@uwe...
> > Use environment variables. The built in environment variable you want is
> > %
> > AppData%. For Windows XP it returns
> >
> > {SystemDrive}:\Documents and Settings\{username}\Application Data
> >
> > For Vista and Windows 7 it returns
> >
> > {SystemDrive}:\Users\{username}\AppData\Roaming
> >
> > Example usage:
> >
> > %AppData%\myFolder\Prg.mde
> >
> > Chris
> >
> >
> > John G wrote:
> >>Running MS Access 2003 on Windows XP
> >>Is it possible to run a command line switch without knowing the exact
> >>paths?
> >>The following command line works good as long as the files "Prg.mde" and
> >>"secure.mdw" are in C:\Program Files\myFolder\.
> >>
> >>Shell pathname:=("""C:\Program Files\Microsoft
> >>Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde""
> >>/WRKGRP
> >>""C:\Program Files\myFolder\secure.mdw""")
> >>
> >>I know that the files will be at "C:\Documents and
> >>Settings\username\Application Data" (in Windows XP) but the username is
> >>different on every computer. So if the exact path of files "PRG.mde" and
> >>"secure.mdw" is not known; is there a way to use the following in the
> >>above
> >>command line?
> >>
> >>SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
> >>Settings\username\Application Data" (in Windows XP) and returns
> >>"C:\Users\username\AppData\Roaming" (in Windows Vista)
> >>dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
> >>"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"

> >
> > --
> > Message posted via http://www.accessmonster.com
> >

>
>

 
Reply With Quote
 
John G
Guest
Posts: n/a
 
      14th Mar 2009
Thanks for your input Chris, but I'm not the one who put spaces in the path.
John G

"Chris O'C via AccessMonster.com" wrote:

> The problem is because there are spaces in the path. It's why we'd like to
> shoot developers who think it's a good idea to use any characters outside of
> the alphabet, numbers and the underscore to name things. They waste our time.
>
>
> This command line worked for me (1 line, not 2, as it may appear below):
>
> "%AppData%\myFolder\Prg.mde" "C:\Program Files\Microsoft Office\OFFICE11\
> MSACCESS.EXE"
>
> Chris
>
>
> John G wrote:
>
> >However, ""%AppData%\myFolder\Prg.mde"" doesn't work. Error message says
> >"The command line you used to start Microsoft Office Access contains an
> >option that Microsoft Office Access doesn't recognize." "Exit and restart
> >Microsoft Office Access using valid command-line options."
> >I tried %AppData% & ""\myFolder\Prg.mde""
> >and ""%AppData% & \myFolder\Prg.mde""
> >and I have also tried ""%AppData%\myFolder\Prg.mde"".
> >How should I be using it? Maybe not enough quotes?

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200903/1
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      14th Mar 2009
Copy everything in the shaded area (between Code Start and Code End) into a
new module (not a class module nor a module associated with a form or
report).

Change

Shell pathname:=("""C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
""C:\Program Files\myFolder\secure.mdw""")

to

Dim strPath As String

strPath = SpecFolder(CSIDL_APPDATA)
Shell _
pathname:=("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""" & _
strPath & "\Prg.mde"" /WRKGRP """ & strPath & "\secure.mdw""")


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"John G" <(E-Mail Removed)> wrote in message
news:6D2EB611-AC16-4FCD-AA27-(E-Mail Removed)...
> Thanks Doug!
>
> I was trying to use SpecFolder(CSIDL_APPDATA) which I got from
> http://www.mvps.org/access/api/api0054.htm but I didn't know how to use it
> in
> the command line. See my first post.
>
> John G
>
> "Douglas J. Steele" wrote:
>
>> While %AppData% works in BAT files, in VBA, you need to use the Environ
>> function:
>>
>> Shell pathname:=("""C:\Program Files\Microsoft
>> Office\OFFICE11\MSACCESS.EXE"" """ & Environ("AppData") & "\Prg.mde""
>> /WRKGRP
>> """ & Environ("AppData") & "\secure.mdw""")
>>
>> Another alternative would be to use the code from
>> http://www.mvps.org/access/api/api0054.htm to determine the location.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>>
>> "Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
>> news:9308398baef8d@uwe...
>> > Use environment variables. The built in environment variable you want
>> > is
>> > %
>> > AppData%. For Windows XP it returns
>> >
>> > {SystemDrive}:\Documents and Settings\{username}\Application Data
>> >
>> > For Vista and Windows 7 it returns
>> >
>> > {SystemDrive}:\Users\{username}\AppData\Roaming
>> >
>> > Example usage:
>> >
>> > %AppData%\myFolder\Prg.mde
>> >
>> > Chris
>> >
>> >
>> > John G wrote:
>> >>Running MS Access 2003 on Windows XP
>> >>Is it possible to run a command line switch without knowing the exact
>> >>paths?
>> >>The following command line works good as long as the files "Prg.mde"
>> >>and
>> >>"secure.mdw" are in C:\Program Files\myFolder\.
>> >>
>> >>Shell pathname:=("""C:\Program Files\Microsoft
>> >>Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde""
>> >>/WRKGRP
>> >>""C:\Program Files\myFolder\secure.mdw""")
>> >>
>> >>I know that the files will be at "C:\Documents and
>> >>Settings\username\Application Data" (in Windows XP) but the username is
>> >>different on every computer. So if the exact path of files "PRG.mde"
>> >>and
>> >>"secure.mdw" is not known; is there a way to use the following in the
>> >>above
>> >>command line?
>> >>
>> >>SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
>> >>Settings\username\Application Data" (in Windows XP) and returns
>> >>"C:\Users\username\AppData\Roaming" (in Windows Vista)
>> >>dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
>> >>"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"
>> >
>> > --
>> > Message posted via http://www.accessmonster.com
>> >

>>
>>


 
Reply With Quote
 
John G
Guest
Posts: n/a
 
      15th Mar 2009
That is what I was looking for. I didn't have the quotes in the proper place
when I tried it before, but now I do thanks to you!

John G

"Douglas J. Steele" wrote:

> Copy everything in the shaded area (between Code Start and Code End) into a
> new module (not a class module nor a module associated with a form or
> report).
>
> Change
>
> Shell pathname:=("""C:\Program Files\Microsoft
> Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
> ""C:\Program Files\myFolder\secure.mdw""")
>
> to
>
> Dim strPath As String
>
> strPath = SpecFolder(CSIDL_APPDATA)
> Shell _
> pathname:=("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
> """ & _
> strPath & "\Prg.mde"" /WRKGRP """ & strPath & "\secure.mdw""")
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
> "John G" <(E-Mail Removed)> wrote in message
> news:6D2EB611-AC16-4FCD-AA27-(E-Mail Removed)...
> > Thanks Doug!
> >
> > I was trying to use SpecFolder(CSIDL_APPDATA) which I got from
> > http://www.mvps.org/access/api/api0054.htm but I didn't know how to use it
> > in
> > the command line. See my first post.
> >
> > John G
> >
> > "Douglas J. Steele" wrote:
> >
> >> While %AppData% works in BAT files, in VBA, you need to use the Environ
> >> function:
> >>
> >> Shell pathname:=("""C:\Program Files\Microsoft
> >> Office\OFFICE11\MSACCESS.EXE"" """ & Environ("AppData") & "\Prg.mde""
> >> /WRKGRP
> >> """ & Environ("AppData") & "\secure.mdw""")
> >>
> >> Another alternative would be to use the code from
> >> http://www.mvps.org/access/api/api0054.htm to determine the location.
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >>
> >> "Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
> >> news:9308398baef8d@uwe...
> >> > Use environment variables. The built in environment variable you want
> >> > is
> >> > %
> >> > AppData%. For Windows XP it returns
> >> >
> >> > {SystemDrive}:\Documents and Settings\{username}\Application Data
> >> >
> >> > For Vista and Windows 7 it returns
> >> >
> >> > {SystemDrive}:\Users\{username}\AppData\Roaming
> >> >
> >> > Example usage:
> >> >
> >> > %AppData%\myFolder\Prg.mde
> >> >
> >> > Chris
> >> >
> >> >
> >> > John G wrote:
> >> >>Running MS Access 2003 on Windows XP
> >> >>Is it possible to run a command line switch without knowing the exact
> >> >>paths?
> >> >>The following command line works good as long as the files "Prg.mde"
> >> >>and
> >> >>"secure.mdw" are in C:\Program Files\myFolder\.
> >> >>
> >> >>Shell pathname:=("""C:\Program Files\Microsoft
> >> >>Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde""
> >> >>/WRKGRP
> >> >>""C:\Program Files\myFolder\secure.mdw""")
> >> >>
> >> >>I know that the files will be at "C:\Documents and
> >> >>Settings\username\Application Data" (in Windows XP) but the username is
> >> >>different on every computer. So if the exact path of files "PRG.mde"
> >> >>and
> >> >>"secure.mdw" is not known; is there a way to use the following in the
> >> >>above
> >> >>command line?
> >> >>
> >> >>SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
> >> >>Settings\username\Application Data" (in Windows XP) and returns
> >> >>"C:\Users\username\AppData\Roaming" (in Windows Vista)
> >> >>dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
> >> >>"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"
> >> >
> >> > --
> >> > Message posted via http://www.accessmonster.com
> >> >
> >>
> >>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line Syntax for Network Paths =?Utf-8?B?QnVjaw==?= Windows XP Help 3 9th Nov 2006 11:30 AM
Executing "unknown" command line in C# Rune Jacobsen Microsoft C# .NET 1 2nd Jan 2006 09:31 PM
Command line paths...what's the syntax? Hiawatha Bray Windows XP Help 3 18th Mar 2004 05:35 AM
Command line error D2016 : '/RTC1' and '/clr:initialappdomain' command-line options are incompatible Lars Grøtteland Microsoft Dot NET Framework 1 15th Oct 2003 09:35 AM
Command line error D2016 : '/RTC1' and '/clr:initialappdomain' command-line options are incompatible Lars Grøtteland Microsoft Dot NET 1 15th Oct 2003 09:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:56 PM.