Access 2007 – Setting a default hyperlink

I have a project in Access 2007 with hyperlink fields.  What I really needed to do was create a default link to a specific directory – at which point the end user can drill further down into a sub directory and select a specific Word file.

Well – seems to be a bit of a problem – spent some time searching and found requests and questions on how to do this, but not a lot of answers.

So – based on suggestions from here, here and  Allen Browne’s Introduction to Hyperlink Fields page I was able to come up with a VBA function:

Private Function SetHTMLLink(ByRef myControl As TextBox)
  If IsNull(myControl.Value) Then
    myControl.Value = “#\\<hyperlink to source>”
  End If
End Function

What is going on is MS Office Hyperlink fields – this is not limited to Access, Excel uses the same algorithm it seems – works like this:

display text # file name (the hyperlink) # a reference within the file

Okay – so MS parses based on the pound (#) character and passes three parameters to some built-in function.  Which can then be assigned to the Value of the Hyperlink control.  It works – and that is all that matters.

%d bloggers like this: