Solved

ACCESS 2007 - FOLLOW HYPERLINK PROPERTY - MAKING WORD 2007 THE ACTIVE DOCUMENT

Posted on 2009-04-13
11
1,031 Views
Last Modified: 2013-11-28
I coded hyperlinks to display on an Access 2007 report.  The report lists sequential file identifiers assigned to Word documents. Each file identifier listed in the report is hyperlinked.

By clicking on a hyperlink, the user is taken to the desired Word document.

I wrote the following code to achieve this effect:

Private Sub fldNAME_Click()
Dim strInput As String
strInput = "Y:\SERVERPATH\" & fldNAME & ".doc"
Application.FollowHyperlink strInput, _
NewWindow:=True, AddHistory:=True
End Sub

The links work, and the Word documents open.  Well and good.

The problem is this - once the Word document opens, it immediately minimizes.  That is not good.  I need the Word document to remain the open, visible, and active document until the user decides that she is finished looking at it.

I have tried several different approaches; nothing seems to work.

Thanks for your help.
0
Comment
Question by:AccessHack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24131019
AccessHack,

1. If you get rid of the NewWindow and AddHistory line, does it work?

2. Consider just opening it using the Shell Command normally without hyperlinking

Something like this:

Dim varApp As Variant
varApp = Shell("C:\Program Files\Microsoft Office\Office12\WINWORD.EXE c:\YourWordFile.doc", vbNormalFocus)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24131428
FWIW,

I use Access 2007 and when I insert a hyperlink to a Word Document, it always opens Full Screen (Maximized)

JeffCoachman
0
 

Author Comment

by:AccessHack
ID: 24131484

boag2000,

Thanks for your input.  

1.  Deleting the NewWindow and AddHistory line of code did not change the outcome.  

2.  In other contexts, I have seen the Shell Function suggested as an option.  II will study it.  I wonder if that will work here, because the underlying data is dynamic; namely, the path to each Word document will be slightly different depending on the "fldNAME" that a user selects in the report.

Q. Brown

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 125 total points
ID: 24131790
I posted a generic example.

Obviously, you can insert your "fldNAME" variable into the code:

Something *roughly* like this:

Dim varApp As Variant
varApp = Shell("C:\Program Files\Microsoft Office\Office12\WINWORD.EXE c:\" & fldNAME & ".doc", vbNormalFocus)

But, again, I am still curious as to why the hyperlink opens the file minimized.

The Shell proposal is really a workaround.
The bottom line is that the Hyperlink should work.

Let's see if another expert can provide more info...

JeffCoachman
0
 

Author Comment

by:AccessHack
ID: 24131859
boag2000,

I hit upon something that appears to work.  I am posting the code here because I have to think my problem is not the first or last struggle with this issue.  

In my Access database, users open the Word documents from the Access report by clicking on a file identifier located in a field that I will call fldNAME.  

I set the properties of fldNAME so that hyperlinks are displayed on the report.  Users are most comfortable with that "look and feel,"  although technically I believe I am not generating hyperlinks using the code below.

Here is the code I added:

Private Sub fldNAME_Click()

'This code adds hyperlinks to fldNAME in the report that point to
'the WORD DOCS, which open in a new window when a link
'is clicked

Dim strInput As String

strInput = "C:\PATH_NAME\" & fldNAME & ".doc"

Set objWord = CreateObject("Word.Application")

    With objWord
        'Make the application visible.
        .Visible = True

        'Open the document.
        .Documents.Open (strInput)
    End With
End Sub

This coding seems to work well.  Thanks very much for your help, Jeff.

Q. Brown
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132184
OK,

BTW, please do not use ALL CAPS in your post.
1. It is considered SHOUTING, and by association, ...rude.
2. It does absolutely nothing to draw attention to your post.
We are all mature professionals here, and we read questions based on our interest in them, not on attempts to make the question "Stand Out"

Fair enough?
;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132199
Oh, ...and Welcome to Experts-Exchange.com!

;-)

Jeff
0
 

Author Comment

by:AccessHack
ID: 24132653
Thanks, Jeff.  My apologies for the use of caps.  
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132925
;-)
0
 

Author Comment

by:AccessHack
ID: 24133305
I wanted to follow up on one thing you noted above.  You wrote:

" . . . I am still curious as to why the hyperlink opens the file minimized."

I researched FollowHyperlink extensively, as well as the various errors I came upon in trying to make FollowHyperlink work for my purposes.

Unfortunately, I could locate no property or method that would directly cause Word to remain the active Window using FollowHyperlink.  I did not find an explanation of the behavior, either.  I, too, remain curious about the reasons for it.

I again thank you very much for your attention to my little puzzle.  I plan to test-drive the Shell Method you suggested; I may decide that I like that better.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24191712
;-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question