Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Shell command (Access XP)

    When using the shell command I tried the following:
    copy d:datapac globalHexPac NEW PREQ and EEWR.mdb, d:datapac globalPAC EngineersHexPac NEW PREQ and EEWR Engineers3.mdb
    It came back with an error:
    Runtime error 53
    File not found

    Does the file not found relate to the word Copy or othe first filename parameter?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shell command (Access XP)

    Use xcopy and surround the name of the file witch contains spaces with quotes and use the /I to avoid the question if the destination is a file or a directory :
    Shell "xcopy " & Chr(34) & "d:datapac globalHexPac NEW PREQ and EEWR.mdb" & Chr(34) & " " & chr(34) & "d:datapac globalPAC EngineersHexPac NEW PREQ and EEWR Engineers3.mdb" & chr(34) & " /I"
    Francois

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Shell command (Access XP)

    Why not use FileCopy instead of Shell?

    FileCopy "d:datapac globalHexPac NEW PREQ and EEWR.mdb", _
    "d:datapac globalPAC EngineersHexPac NEW PREQ and EEWR Engineers3.mdb"

    Of set a reference to Microsoft Scripting Runtime and use the FileSystemObject; it has a method CopyFile:

    Dim fso As New Scripting.FileSystemObject
    fso.CopyFile "d:datapac globalHexPac NEW PREQ and EEWR.mdb", _
    "d:datapac globalPAC EngineersHexPac NEW PREQ and EEWR Engineers3.mdb"
    ...
    Set fso = Nothing

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Shell command (Access XP)

    This forms part of a scheduler I wrote a number of years ago. The command is imbedded in one text field in a table.
    Does the shell command push out the text to a dos command processor?
    I have tried this in the past to run Access commands to compact a database.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Shell command (Access XP)

    Shell does indeed call a DOS command processor (but in Windows 2000 and XP, that is a simulated DOS <img src=/S/grin.gif border=0 alt=grin width=15 height=15>).

    Francois' method should work, but in general, it is not necessary to use Shell to copy files, since file copying is built into VBA.

Posting Permissions

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