Results 1 to 6 of 6
  1. #1
    shank is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    188

    Running File System Commands in Module

    Win 10 Pro


    MS Access 2019
    64 Bit

    Is it possible to run file system commands in a module? I've been trying to run an app (batch file) from a macro, but it just won't cooperate.

    The file is "S:\Order Imports\FE\BatchFiles\Rename.bat"
    I can run it manually (double-click) - no problem.
    I've tried using the UNC address. Still no luck.
    I don't get any errors. It just doesn't run.
    If I can run manually, I assume I have permissions.

    I'm just curious if I could put these commands in a module and get better results.

    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    call shell ( "S:\Order Imports\FE\BatchFiles\Rename.bat")

  3. #3
    shank is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    188
    I'm assuming the Call Shell command is in a module, correct?
    They below is causing issues with Tools > References on some queries.
    I delete the below module and the queries work again.
    I'm sure I'm doming this wrong.

    Dim RunBatch
    RunBatch = Shell("S:\Order Imports\FE\BatchFiles\Rename.bat")

    thanks!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Why use vba code to call a batch file to rename files when the code itself can do it?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    shank is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    188
    I started from scratch and moved my batch file to a friendlier folder and it works now.

    Thank you all for input!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Running a module from cmd button
    By Robert2150 in forum Modules
    Replies: 5
    Last Post: 10-23-2018, 02:13 AM
  2. Running a Module - Keep getting Errors
    By griztkojr in forum Modules
    Replies: 20
    Last Post: 04-20-2018, 01:35 PM
  3. Running Module with Macro
    By cm-net in forum Macros
    Replies: 2
    Last Post: 01-20-2018, 08:04 AM
  4. Running subroutines and form commands in another database
    By cinciphantom in forum Programming
    Replies: 1
    Last Post: 03-16-2011, 01:55 PM
  5. Running a module
    By KevinMCB in forum Modules
    Replies: 2
    Last Post: 03-09-2011, 02:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums