Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    2

    Unanswered: Problem with Shell Command in Access VB

    This is the statement that I am having problems with;

    Function Check_Tapes()
    Dim a As Double
    a = Shell("msaccess \\Tpasan01\jwtest\STREAM\sbdats\Sbdat 2000.mdb /xAutoImport")
    End Function

    It is supposed to kick off a macro in another DB, but the problem is the other DB has a space in the name, and when I try to run the macro it does not recognize the space, so it comes back with an error that it can't find the DB.

    I know that I could rename the target DB, but the problem is that the tables are referenced by several other DBs and I would have to fix them all.

    Is there a way to fix this short of renaming?

    Thanks,
    Steve

  2. #2
    Join Date
    Dec 2004
    Posts
    11
    Shell commands separate their elements using spaces, so if your path has a space in it, it needs to be enclosed in double quotes. See if this works:

    Function Check_Tapes()
    Dim a As Double
    a = Shell("msaccess ""\\Tpasan01\jwtest\STREAM\sbdats\Sbdat 2000.mdb"" /xAutoImport")
    End Function

    Notice that there are two sets of quotes before and after your path. That's necessary to enter a quote character inside of a string.

  3. #3
    Join Date
    Nov 2006
    Posts
    2
    Thanks, I knew that it had to be something like that, but I couldn't figure it out.

    That took care of it.
    Steve

Posting Permissions

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