Opening windows folder

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

    #1

    Opening windows folder

    I'm trying to use a command button to open a windows folder related to the
    current record. The record has a Location field that contains the name of
    the windows folder, in the current directory that needs to be opened. The
    code for the command button is...

    Dim RetVal
    RetVal = Shell("explorer CurrentProject. Path & " \ " & Me.Location",
    vbNormalFocus)

    When the button is pressed, I get an error - Type Mismatch

    I am using the following code to view a picture of the relevent file in an
    image box in the record:

    Me.imgEmployee. Picture = CurrentProject. Path & "\" & Me.Location & "\" &
    Me.Headshot

    This code works fine. Also, if I hard code a file location into the first
    line of code, it also work fine:

    Dim RetVal
    RetVal = Shell("explorer c:\employees\", vbNormalFocus)

    This will open up the employees folder on the c: drive


  • Wayne Gillespie

    #2
    Re: Opening windows folder

    On Fri, 03 Oct 2008 01:11:27 GMT, "Kevin" <none@email.com wrote:
    >I'm trying to use a command button to open a windows folder related to the
    >current record. The record has a Location field that contains the name of
    >the windows folder, in the current directory that needs to be opened. The
    >code for the command button is...
    >
    Dim RetVal
    RetVal = Shell("explorer CurrentProject. Path & " \ " & Me.Location",
    >vbNormalFocu s)
    >
    >When the button is pressed, I get an error - Type Mismatch
    >
    >I am using the following code to view a picture of the relevent file in an
    >image box in the record:
    >
    Me.imgEmployee. Picture = CurrentProject. Path & "\" & Me.Location & "\" &
    >Me.Headshot
    >
    >This code works fine. Also, if I hard code a file location into the first
    >line of code, it also work fine:
    >
    Dim RetVal
    RetVal = Shell("explorer c:\employees\", vbNormalFocus)
    >
    >This will open up the employees folder on the c: drive
    >
    Try

    RetVal = Shell("explorer " & CurrentProject. Path & " \ " & Me.Location",
    vbNormalFocus)


    Wayne Gillespie
    Gosford NSW Australia

    Comment

    • Stuart McCall

      #3
      Re: Opening windows folder

      "Wayne Gillespie" <bestfit@NObest fitSPAMsoftware PLEASE.com.auwr ote in
      message news:5tvae4pbau r7aeqtim59rdn8b kf9fiqvv3@4ax.c om...
      On Fri, 03 Oct 2008 01:11:27 GMT, "Kevin" <none@email.com wrote:
      >
      >>I'm trying to use a command button to open a windows folder related to the
      >>current record. The record has a Location field that contains the name of
      >>the windows folder, in the current directory that needs to be opened. The
      >>code for the command button is...
      >>
      > Dim RetVal
      > RetVal = Shell("explorer CurrentProject. Path & " \ " & Me.Location",
      >>vbNormalFocus )
      >>
      >>When the button is pressed, I get an error - Type Mismatch
      >>
      >>I am using the following code to view a picture of the relevent file in an
      >>image box in the record:
      >>
      > Me.imgEmployee. Picture = CurrentProject. Path & "\" & Me.Location & "\"
      >&
      >>Me.Headshot
      >>
      >>This code works fine. Also, if I hard code a file location into the first
      >>line of code, it also work fine:
      >>
      > Dim RetVal
      > RetVal = Shell("explorer c:\employees\", vbNormalFocus)
      >>
      >>This will open up the employees folder on the c: drive
      >>
      >
      Try
      >
      RetVal = Shell("explorer " & CurrentProject. Path & " \ " &
      Me.Location",
      vbNormalFocus)
      >
      >
      Wayne Gillespie
      Gosford NSW Australia
      That's still slightly off. Should be:

      Dim q As String
      q = Chr(34)
      RetVal = Shell("explorer " & q & CurrentProject. Path & " \ " & Me.Location &
      q, vbNormalFocus)


      Comment

      Working...