By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,704 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,704 IT Pros & Developers. It's quick & easy.

Opening windows folder

P: n/a
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
Oct 3 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 03 Oct 2008 01:11:27 GMT, "Kevin" <no**@email.comwrote:
>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
Oct 3 '08 #2

P: n/a
"Wayne Gillespie" <be*****@NObestfitSPAMsoftwarePLEASE.com.auwrote in
message news:5t********************************@4ax.com...
On Fri, 03 Oct 2008 01:11:27 GMT, "Kevin" <no**@email.comwrote:
>>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)
Oct 3 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.