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

ErrHandler:

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

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.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com 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
correctly.


"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.

Cheers

Nick
.



Relevant Pages

  • RE: Inserting Hyperlinks into table fields
    ... using VBA Code. ... Private Sub InsertRecBtn_Click ... "Text to display" is the text string to be displayed in the ... See http://www.QBuilt.com for all your database needs. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Return records within whatever date range is entered on Form
    ... I added acNormal to my VBA code so that the form will display in Form ... Private Sub Command108_Click ...     Dim stLinkCriteria As String ... strSQL = Left ...
    (comp.databases.ms-access)
  • 2 VBA Codes zusamen fuegen
    ... Die zweite VBA Code ist da sodass wenn man die zeit eingibt ohne dass Doppel ... ) Is Nothing Then Exit Sub ... End Sub ...
    (microsoft.public.de.excel)
  • Re: Error 2501 Problem when DoubleClicking to Delete Record is Can
    ... >> Private Sub DeleteRecord_DblClick ... >>> Dim Response As Integer ... >>> On Error GoTo Err_DeleteRecord_Click ... >>>> as you can see from my humble vba code below, i want to tell the user ...
    (microsoft.public.access.formscoding)
  • Re: Regarding Subform update
    ... First, don't think you need the procedure as a Function, just make it a Sub. ... the VBA code, paste your code from the function into the Sub. ... Dim strSQL As String ... I have a button which executes a macro with following actions ...
    (microsoft.public.access.forms)