Assemble and insert hyperlink

P

plh

Hello All,
What I need to do is assemble an address for a hyperlink then paste it into the
text box that references a table field with a Data Type "Hyperlink", so as to
allow the user to click on it & open it with a predetermined application that
windows will choose based on extension. Alternately, I could just have the a
command button open the file whose location I assembled. But in the case of the
first option, I have defined:


Public Const DRAWINGFOLDER1 As String = "I:\ENGINEERING\00 - VAULT\Solidworks
Files\COMPLETE\0-9\2095,000-2119,999\"
Public Const DRAWINGEXTEN1 As String = ".SLDDRW"

The user will enter a part number into text box ".txtDrawingNumber" then the use
a command that uses this code:

With Me

.lnkSample.SetFocus
DoCmd.RunCommand acCmdPasteAsHyperlink, DRAWINGFOLDER1 & .txtDrawingNumber.Value
& DRAWINGEXTEN1

'.lnkSample.Hyperlink.Address = DRAWINGFOLDER1 & .txtDrawingNumber.Value &
DRAWINGEXTEN1
'.lnkSample.Hyperlink.TextToDisplay = .txtDrawingNumber.Value

End With

"lnkSample" is the hyperlink referencing text box
In the case of the commented out commands it's telling me that is a read only
value, and in the case of the RunCommand I tried various "acCmd..."s and they
all said I was trying to use too many options.

I'd have users do a standard hyperlink edit, but in this joint, the BLOCKHEAD
who set up the file system has THOUSANDS and THOUSANDS of files in each of these
folders, so that technique takes forever or simply hangs, and I have already
found out in the past that this is an arm wrestling match that I am NOT GOING TO
WIN. So I am stuck with dreaming up a work around. Can anyone help me?
Thank You, Lifesaver!
-plh
 
D

Dirk Goldgar

plh said:
Hello All,
What I need to do is assemble an address for a hyperlink then paste it
into the
text box that references a table field with a Data Type "Hyperlink", so as
to
allow the user to click on it & open it with a predetermined application
that
windows will choose based on extension. Alternately, I could just have the
a
command button open the file whose location I assembled. But in the case
of the
first option, I have defined:


Public Const DRAWINGFOLDER1 As String = "I:\ENGINEERING\00 -
VAULT\Solidworks
Files\COMPLETE\0-9\2095,000-2119,999\"
Public Const DRAWINGEXTEN1 As String = ".SLDDRW"

The user will enter a part number into text box ".txtDrawingNumber" then
the use
a command that uses this code:

With Me

.lnkSample.SetFocus
DoCmd.RunCommand acCmdPasteAsHyperlink, DRAWINGFOLDER1 &
.txtDrawingNumber.Value
& DRAWINGEXTEN1

'.lnkSample.Hyperlink.Address = DRAWINGFOLDER1 & .txtDrawingNumber.Value &
DRAWINGEXTEN1
'.lnkSample.Hyperlink.TextToDisplay = .txtDrawingNumber.Value

End With

"lnkSample" is the hyperlink referencing text box
In the case of the commented out commands it's telling me that is a read
only
value, and in the case of the RunCommand I tried various "acCmd..."s and
they
all said I was trying to use too many options.

I'd have users do a standard hyperlink edit, but in this joint, the
BLOCKHEAD
who set up the file system has THOUSANDS and THOUSANDS of files in each of
these
folders, so that technique takes forever or simply hangs, and I have
already
found out in the past that this is an arm wrestling match that I am NOT
GOING TO
WIN. So I am stuck with dreaming up a work around. Can anyone help me?


A hyperlink field is just a specially marked-up text field. Try this code:

With Me

.lnkSample =
.txtDrawingNumber & "#" & _
DRAWINGFOLDER1 & .txtDrawingNumber & DRAWINGEXTEN1 & _
"#"

End With
 
P

plh

A hyperlink field is just a specially marked-up text field. Try this code:

With Me

.lnkSample =
.txtDrawingNumber & "#" & _
DRAWINGFOLDER1 & .txtDrawingNumber & DRAWINGEXTEN1 & _
"#"

End With
That worked wonderfully, thank you!
-plh
 

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

Similar Threads


Top