Hi Bill
First, a string literal (constant) in VBA must be enclosed in double quotes, so this will not work:
Application.FollowHyperlink \\ARMOR\Business\Groups
Instead it should be:
Application.FollowHyperlink "\\ARMOR\Business\Groups"
Next, if you want to concatenate strings in VBA (glue them together) then you use the & operator. So, to concatenate the value in the control called “OrganizationName”, you do this:
Application.FollowHyperlink "\\ARMOR\Business\Groups\" & Me.OrganizationName
Notice that we need the extra backslash, otherwise the code would attempt to go to \\ARMOR\Business\GroupsHayfield
Best wishes,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, 13 June 2014 06:05
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Link
Graham,
Thanks for the info. I received a few responses and read them all over. This one worked first.
I should have been more clear, I want to open a folder, actually a sub folder. I now have a button on my form that open a folder, which is my main folder. Below is the code. There is just one line of code.
Application.FollowHyperlink \\ARMOR\Business\Groups
However, within the “Groups” folder there are other folders. The folder I want to go to is the folder that is named the same as the name in my combo box called “OrganizationName”.
For example if I was on the record for Hayfield and the combo box said Hayfield the link would go to
Application.FollowHyperlink \\ARMOR\Business\Groups\Hayfield
I am guessing I would have to do something like
Private Sub Command19_Click()
Dim strName as string
strName= txt.OrganizationName
Application.FollowHyperlink \\ARMOR\Business\Groups\strName
End Sub
Am I anywhere close. I will try to mess with this a bit if I can.
Bill
MN
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Wednesday, June 11, 2014 5:02 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Link
Hello Bill
You can use FollowHyperlink to open a folder in Windows File Explorer – for example:
FollowHyperlink "C:\Windows"
FollowHyperlink "\\server\myshare\My Folder"
FollowHyperlink CurrentProject.Path
FollowHyperlink Me.SomeControlName
The last of these shows how the destination can change with different records. Or, of course, your code could “construct” the destination folder from values in the current record – perhaps by removing the file name from a full path.
All the best,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, 12 June 2014 09:48
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Link
I am wondering if it is possible to make a button on one of my forms browse to a certain location on my network or on my computer. I keep going back and forth and it would sure be nice to have quicker access.
The next question is… is it possible for that button to go to different files on the network based on the Access record that I am on?
Thanks for your help.
Bill
MN
Posted by: "Graham Mandeno" <graham@mandeno.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
Tidak ada komentar:
Posting Komentar