Hyperlink to Word document

R

RL

Good afternoon,

I have a basic prospecting database. My sales guys can select 'Send letter'
from any contact record. This does two things:
1. Populates a temporary table used for mailmerging.
2. Opens a form containing a combo box listing the available letters.

The combo box is populated by a separate table, which contains the following
fields: [l_ID], [l_name], [l_description] and [l_filepath]. When they select
a letter from the [l_name] drop down list, I would like Access to open the
corresponding Microsoft Word document, which contains the required merge
fields.

I'm not hot with VBA (understatement!) so generally use macros whenever
possible. However, there doesn't appear to be any Macro options to suit and
am therefore going down the VBA route.

I have tinkered with the Object.Hyperlink.Follow method, to no avail. I'm
not sure whether I am mis-using that expression, or it is the wrong
expression to use.

The following error pops up:
Run-time error '2465':
Microsoft Office Access can't find the field 'l' referred to in your
expression.

Would you be able to advise me where I'm going wrong and if possible point
me in the direction of the code required to achieve the above. If I have
overcomplicated it, a simpler means of achieving the same result would also
be much appreciated.

Regards
RL
 
D

Daniel Pineault

What is your current vba code?

you need to try something like

Application.FollowHyperlink Me.[ComboBoxName]Column(l_filepathColumnNumber)

Where you need to substitute ComboBoxName and l_filepathColumnNumber with
the appropriate values.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
R

RL

Morning Daniel, thanks for your advice - you're a star.

My code now reads as follows...

Private Sub Combo8_AfterUpdate()
Application.FollowHyperlink Me.[Combo8].Column(2)
End Sub

....and works like a dream!

Regards,
RL

Daniel Pineault said:
What is your current vba code?

you need to try something like

Application.FollowHyperlink Me.[ComboBoxName]Column(l_filepathColumnNumber)

Where you need to substitute ComboBoxName and l_filepathColumnNumber with
the appropriate values.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



RL said:
Good afternoon,

I have a basic prospecting database. My sales guys can select 'Send letter'
from any contact record. This does two things:
1. Populates a temporary table used for mailmerging.
2. Opens a form containing a combo box listing the available letters.

The combo box is populated by a separate table, which contains the following
fields: [l_ID], [l_name], [l_description] and [l_filepath]. When they select
a letter from the [l_name] drop down list, I would like Access to open the
corresponding Microsoft Word document, which contains the required merge
fields.

I'm not hot with VBA (understatement!) so generally use macros whenever
possible. However, there doesn't appear to be any Macro options to suit and
am therefore going down the VBA route.

I have tinkered with the Object.Hyperlink.Follow method, to no avail. I'm
not sure whether I am mis-using that expression, or it is the wrong
expression to use.

The following error pops up:
Run-time error '2465':
Microsoft Office Access can't find the field 'l' referred to in your
expression.

Would you be able to advise me where I'm going wrong and if possible point
me in the direction of the code required to achieve the above. If I have
overcomplicated it, a simpler means of achieving the same result would also
be much appreciated.

Regards
RL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top