Hyperlinks in Microsoft Access is an excellent tool to open internal or external objects very easily, without writing macros or VBA Code. Hyperlink Address and Hyperlink SubAddress properties are available on Label controls, Command Buttons and Image controls.

We have already looked into few examples earlier, dealing with hyperlinks. Links to those articles are given at the end of this page for reference.

If you have not yet tried anything with these properties of the above controls then let us go straight into a demo run and learn the usage of both these properties.

  1. Create a new Blank Form.
  2. Insert a Label control on the Form.
  3. While the label control is still in selected state display its Property Sheet (F4).

    Note: Hyperlink Address and Hyperlink SubAddress Properties are used for different purposes.

    • Hyperlink Address : for opening external objects, like Word Documents, Excel Worksheets, .PDF files etc.
    • Hyperlink SubAddress : for opening internal objects, like Forms, Reports, Tables, Queries and Macros.

    Hyperlink Address

    Let us open a Report from your database using Hyperlink SubAddress property setting.

  4. Find the Hyperlink SubAddress property and write the following text into it:
    Report <Your Report Name>
    

    Replace <Your Report Name> text with one of your own report name (without the < > brackets). The correct format for writing value into this property is <Object Type> i.e. Form, Report, Table, Query or Macro followed by a space, followed by the actual Object name.

  5. Change the Caption Property value of the Label to Open Report.
  6. Save the Form, with the Label control’s Hyperlink SubAddress value set with the above changes.
  7. Open the Form in normal view and click on the label control.

You will see now your report is open in Print Preview.

Now, let us try to open a MS-Word Document using the other property, Hyperlink Address setting.

  1. Open your Form and create a second Label control on it.
  2. Display the property sheet of the label control.
  3. Change the Caption property value to Open WordDoc.
  4. Set the Hyperlink Address property value with the full pathname of a Word Document on your computer, like C:\My Documents\Letter.doc
  5. Save the Form with the changes.
  6. Open the Form in normal view and click on the second label to open the Document in MS-Word.

Note: You can open Web pages by setting the Hyperlink Address property value to a web address: say http://www.msaccesstips.com/

If your external files, which you plan to open in Access, are all in one location C:\My Documents\ then you don’t need to duplicate it in every control but to specify the Path (C:\My Documents\) at one place: Hyperlink Base and only need to write the document name (like Letter.doc or any other file on that location) in the Hyperlink Address property.

Hyperlink SubAddress

Let us try that:

  1. Click on the Office Button Hyperlink Address and highlight Manage to display Database options (Access 2007). In Access 2003 and earlier versions, you will find this option in Tools Menu.
  2. Select Database Properties.
  3. Select Summary Tab.
  4. Type C:\My Documents\ in the Hyperlink Base control (see the image given above)  and click OK to save it.
  5. Open your Form and remove the C:\My Documents\ text typed in for earlier example, leaving the Letter.doc file name intact.
  6. Save the Form and click on the label control to open the Word Document.
  7. You may try to open any other document you have in that location, with only the file name change on the Label control.
Opening Objects from another Microsoft Access Database.

If you have followed me so far with the above sample exercises, then with few changes we can do it.

  1. First, remove the text from Hyperlink Base control (‘C:\My Documents\’) and leave the control empty.
  2. Create another Label control on your Form.
  3. Change the Caption Property value to Ext. Database.
  4. Set the Hyperlink Address property value with your external database path, like: C:\mdbs\myDatabase.accdb.
  5. Set the Hyperlink SubAddress property value to Report myReport. Change the report name to match yours.
  6. Save the Form with the change.
  7. Open the Form in normal view and click on the label control.

Your external database will open first and will show your report in print preview.

Note: If your database is secured then it will prompt for UserID and Password. You may try to open other objects: Form, Query, Macro & Table.