RE: Inserting Hyperlinks into table fields

"'69 Camaro" wrote:

Hi, Nick.

I want to insert a hyperlink into a table field
using VBA Code.

To insert a record into the table, try:

Private Sub InsertRecBtn_Click()

On Error GoTo ErrHandler

CurrentDb().Execute "INSERT INTO tblHyperlinks (HypLink) " & _
"VALUES ('Text to display#" & _
"C:\Data\MyFile.txt##" & _
"C:\Data\MyFile.txt');", dbFailOnError

Exit Sub


MsgBox "Error in InsertRecBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description

End Sub ' InsertRecBtn_Click( )

. . . where tblHyperlinks is the name of the table, HypLink is the name of
the field, "Text to display" is the text string to be displayed in the
hyperlink field, and C:\Data\MyFile.txt is the path to the file.


See for all your database needs.
See for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions

"Nick" wrote:

Hi I hope soemone can help. I want to insert a hyperlink into a table field
using VBA Code. I also want the display name to be different form the
hyperlink address.