Shell command and File Not Found

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jimmy

    #1

    Shell command and File Not Found

    Im using the following code to open a second access database:

    Dim stAppName As String
    Dim retVal As Integer

    stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
    retVal = Shell(stAppName , 1)

    and access returns an error of File Not Found. I tried the following
    variation with the same result:

    Dim stAppName As String
    stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
    Call Shell(stAppName , 1)

    Dim stAppName As String
    stAppName = "C:\Program Files\Microsoft Office\OFFICE11 \msaccess.exe" &_
    "C:\PlantManage r\Plants.mdb"
    Call Shell(stAppName , 1)

    Dim stAppName As String
    stAppName = "msaccess.e xe" & Chr(34) & "C:\PlantManage r\Plants.mdb" &
    Chr(34)
    Call Shell(stAppName , 1)

    any thoughts


  • Lyle Fairfield

    #2
    Re: Shell command and File Not Found

    On Feb 17, 7:58 pm, "Jimmy" <d...@email.mew rote:
    Im using the following code to open a second access database:
    >
    Dim stAppName As String
    Dim retVal As Integer
    >
    stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
    retVal = Shell(stAppName , 1)
    >
    and access returns an error of File Not Found. I tried the following
    variation with the same result:
    >
    Dim stAppName As String
    stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
    Call Shell(stAppName , 1)
    >
    Dim stAppName As String
    stAppName = "C:\Program Files\Microsoft Office\OFFICE11 \msaccess.exe" &_
    "C:\PlantManage r\Plants.mdb"
    Call Shell(stAppName , 1)
    >
    Dim stAppName As String
    stAppName = "msaccess.e xe" & Chr(34) & "C:\PlantManage r\Plants.mdb" &
    Chr(34)
    Call Shell(stAppName , 1)
    >
    any thoughts
    Thought1:
    Shell SysCmd(acSysCmd AccessDir) & "MsAccess.E xe " _
    & """C:\Docum ents and Settings\Lyle Fairfield\My Documents\Acces s
    \northwind.mdb" ""

    Thought2:
    Dim a As Access.Applicat ion

    Sub temp()
    Set a = New Access.Applicat ion
    With a
    .OpenCurrentDat abase "C:\Documen ts and Settings\Lyle Fairfield\My
    Documents\Acces s\northwind.mdb "
    .Visible = True
    End With
    End Sub

    Sub Later()
    If Not a Is Nothing Then
    a.Quit
    Set a = Nothing
    End If
    End Sub

    Thought3:
    When you tell why sometimes there are better ways suggested.


    Comment

    • CDMAPoster@FortuneJames.com

      #3
      Re: Shell command and File Not Found

      On Feb 17, 7:58 pm, "Jimmy" <d...@email.mew rote:
      Im using the following code to open a second access database:
      >
      Dim stAppName As String
      Dim retVal As Integer
      >
      stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
      retVal = Shell(stAppName , 1)
      >
      and access returns an error of File Not Found. I tried the following
      variation with the same result:
      >
      Dim stAppName As String
      stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
      Call Shell(stAppName , 1)
      >
      Dim stAppName As String
      stAppName = "C:\Program Files\Microsoft Office\OFFICE11 \msaccess.exe" &_
      "C:\PlantManage r\Plants.mdb"
      Call Shell(stAppName , 1)
      >
      Dim stAppName As String
      stAppName = "msaccess.e xe" & Chr(34) & "C:\PlantManage r\Plants.mdb" &
      Chr(34)
      Call Shell(stAppName , 1)
      >
      any thoughts
      http://www.m-w.com/dictionary/Isthisatrickquestion?

      The word you've entered isn't in the dictionary. Click on a spelling
      suggestion below or try again using the search bar above.

      Suggestions for isthisatrickque stion?:
      1. aesthetic distance
      2. East Stroudsburg
      3. aussitot dit, aussitot fait

      ..exe "

      James A. Fortune
      CDMAPoster@Fort uneJames.com

      Comment

      • '69 Camaro

        #4
        Re: Shell command and File Not Found

        Hi, Jimmy.
        any thoughts
        This line of code concatenates two strings together:

        stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"

        After it executes the stAppName variable contains
        "msaccess.exeC: \PlantManager\P lants.mdb" -- so look at it a little closer,
        and tell me why your operating system can't find a file on the
        msaccess.exeC:\ drive.

        HTH.
        Gunny

        See http://www.QBuilt.com for all your database needs.
        See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
        Blog: http://DataDevilDog.BlogSpot.com
        http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
        info.


        "Jimmy" <dont@email.mew rote in message
        news:9xNBh.6597 $VE5.247@fe01.n ews.easynews.co m...
        Im using the following code to open a second access database:
        >
        Dim stAppName As String
        Dim retVal As Integer
        >
        stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
        retVal = Shell(stAppName , 1)
        >
        and access returns an error of File Not Found. I tried the following
        variation with the same result:
        >
        Dim stAppName As String
        stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
        Call Shell(stAppName , 1)
        >
        Dim stAppName As String
        stAppName = "C:\Program Files\Microsoft Office\OFFICE11 \msaccess.exe"
        &_
        "C:\PlantManage r\Plants.mdb"
        Call Shell(stAppName , 1)
        >
        Dim stAppName As String
        stAppName = "msaccess.e xe" & Chr(34) & "C:\PlantManage r\Plants.mdb" &
        Chr(34)
        Call Shell(stAppName , 1)
        >
        any thoughts
        >

        Comment

        • Jimmy

          #5
          Re: Shell command and File Not Found


          "'69 Camaro" <ForwardZERO_SP AM.To.69Camaro@ Spameater.orgZE RO_SPAMwrote in
          message news:12tfab9hov 4e410@corp.supe rnews.com...
          This line of code concatenates two strings together:
          >
          stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
          >
          stAppName = "msaccess.e xe C:\PlantManager \Plants.mdb"

          works like a charm!


          Comment

          • Jimmy

            #6
            Re: Shell command and File Not Found

            What?

            <CDMAPoster@For tuneJames.comwr ote in message
            news:1171761482 .831896.114600@ v33g2000cwv.goo glegroups.com.. .
            On Feb 17, 7:58 pm, "Jimmy" <d...@email.mew rote:
            >Im using the following code to open a second access database:
            >>
            > Dim stAppName As String
            > Dim retVal As Integer
            >>
            > stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
            > retVal = Shell(stAppName , 1)
            >>
            >and access returns an error of File Not Found. I tried the following
            >variation with the same result:
            >>
            > Dim stAppName As String
            > stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
            > Call Shell(stAppName , 1)
            >>
            > Dim stAppName As String
            > stAppName = "C:\Program Files\Microsoft Office\OFFICE11 \msaccess.exe"
            >&_
            > "C:\PlantManage r\Plants.mdb"
            > Call Shell(stAppName , 1)
            >>
            > Dim stAppName As String
            > stAppName = "msaccess.e xe" & Chr(34) & "C:\PlantManage r\Plants.mdb" &
            >Chr(34)
            > Call Shell(stAppName , 1)
            >>
            >any thoughts
            >
            http://www.m-w.com/dictionary/Isthisatrickquestion?
            >
            The word you've entered isn't in the dictionary. Click on a spelling
            suggestion below or try again using the search bar above.
            >
            Suggestions for isthisatrickque stion?:
            1. aesthetic distance
            2. East Stroudsburg
            3. aussitot dit, aussitot fait
            >
            .exe "
            >
            James A. Fortune
            CDMAPoster@Fort uneJames.com
            >

            Comment

            • '69 Camaro

              #7
              Re: Shell command and File Not Found

              Hi, Jimmy.
              stAppName = "msaccess.e xe C:\PlantManager \Plants.mdb"
              >
              works like a charm!
              Good job!

              HTH.
              Gunny

              See http://www.QBuilt.com for all your database needs.
              See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
              Blog: http://DataDevilDog.BlogSpot.com
              http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
              info.


              "Jimmy" <dont@email.mew rote in message
              news:ZP0Ch.1385 69$dB4.24033@fe 08.news.easynew s.com...
              >
              "'69 Camaro" <ForwardZERO_SP AM.To.69Camaro@ Spameater.orgZE RO_SPAMwrote
              in message news:12tfab9hov 4e410@corp.supe rnews.com...
              >
              >This line of code concatenates two strings together:
              >>
              > stAppName = "msaccess.e xe" & "C:\PlantManage r\Plants.mdb"
              >>
              >
              stAppName = "msaccess.e xe C:\PlantManager \Plants.mdb"
              >
              works like a charm!
              >

              Comment

              • CDMAPoster@FortuneJames.com

                #8
                Re: Shell command and File Not Found

                On Feb 18, 1:24 pm, "Jimmy" <d...@email.mew rote:
                What?
                Exactly. The point was to show you, from Access' perspective, what
                you did. Access was forced to say, "What?" because of the missing
                space. If you have a space in the path be sure to find a way to
                include double quotes as shown by Lyle or your example containing
                Chr(34). Explaining it detracts from the total effect though.

                James A. Fortune
                CDMAPoster@Fort uneJames.com

                Comment

                Working...