Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    /cmd with XP (Access 2002)

    I have used the /cmd command in shortcuts in Access 97 but it does not seem to work under Access 2002. I use the function to set a parameter in my code to point to the location of the data files: "C:My FilesMyApp.mde" /cmd "C:My DataMyAppData.mdb"

    Has anybody seen this same behavior?

    Thanks,

    HB

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: /cmd with XP (Access 2002)

    To my knowledge it still works - check the help file for the Command function and it should tell you about it. You should also be able to check very quickly in the VBA debug window with a statement
    ? Command
    I'll check 2002 later as I'm on 2000 and it seems to work.
    Wendell

  3. #3
    New Lounger
    Join Date
    Sep 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: /cmd with XP (Access 2002)

    Thanks for the quick reply. I too have confirmed it works under Access 2000. It seems to be XP(Access 2002) that's not reading the shortcut line properly. Let me know if you find anything else.

    Much appreciated.

    HB

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: /cmd with XP (Access 2002)

    After a fair bit of research it appears to me that they may have removed the option in the VBA engine to use the function. The help file for the command line still lists the /cmd options, but the VBA Help file indicates that the Command() function is not available to Office applications. There is an article in the MS Knowledge base that describes how to use the various command line functions with Access 2000, but no comparable article for Access 2002. I have this sneaky suspicion that MS may have removed it because of security concerns(?), or they may have ended up with a conflict with ADO2.5 or whatever the latest version is. Hopefully one of the gurus will have some input on this???
    Wendell

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: /cmd with XP (Access 2002)

    I'm not sure that makes sense, Wendell. All the Command() function does is return the command line argument passed in, and both Office 2k and Office XP are based on the same version of VB/VBA. If they remove the ability to evaluate the command line arguments, then they disable a rather significant capability in Access at least. I'm not at an OXP machine right now, but isn't the command line argument textbox still on the Tools-->Options-->Advanced tab in the Access XP UI? If it is, then there much be a way to evaluate it. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    One thing is true, though, and that is that you have to include the full path and filename for both the Access executable and for the database being opened before command line arguments are actually passed. I didn't see that in the earlier post, unless only a part of the entire line was included.
    Charlotte

  6. #6
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: /cmd with XP (Access 2002)

    I never used Command function in A97 or A2K, after reading foregoing did quick test to see if works in Access 2002 aka AXP. Modified shortcut to a test database. At first all tests proved futile, Command function returned nothing. Checked Help files, Command function and /cmd startup command-line options allegedly still valid in AXP. On hunch modified shortcut to include path to MSACCESS.EXE. Command function then worked!! Example of command line I used:

    "C:Program FilesMicrosoft OfficeOffice10MSACCESS.EXE" C:ACCESSNorthwindTest.mdb ; "ABC"

    Note that the example in VBA Help file for Command Function did in fact include path to executable, but nowhere does it state that this is REQUIRED for function to work correctly. That might have been useful to point out. Also note, as shown above you can replace the "/cmd" in command line with a semicolon. As noted in Help file, "This option must be the last option on the command line. You can use a semicolon ([img]/forums/images/smilies/wink.gif[/img] as an alternative to /cmd. "

    HTH

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: /cmd with XP (Access 2002)

    I don't know why the help doesn't include a warning about using the full path to the Access executable when passing in command line arguments. It's one of those things "everyone" knows, but I'm sure I've seen it somewhere, possibly in a knowledge base article.
    Charlotte

  8. #8
    New Lounger
    Join Date
    Sep 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: /cmd with XP (Access 2002)

    Thanks for all the help. The quick way of creating the shortcut to the MDE under XP leaves out the executable in its path. The assumption is that Windows knows what application to run with the MDE file. I'll put the executable in the shortcut path and try things again.

    Now I won't have to pull anymore hair out trying to figure this out. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •