Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Hyperlink Opens Objects from Another Database

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.

    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://msaccess-tips.blogspot.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.

Let us try that:

  1. Click on the Office Button
    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.

Share:

No comments:

Post a Comment

Translate



PageRank
Your email address:

Delivered by FeedBurner

Search

Infolinks Text Ads

blog.feedspot.com Microsoft Access Blogs

Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.

Labels

Forms How Tos Functions MS-Access Security Reports msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Queries External Links msaccess reports msaccess tips Accesstips Menus and Toolbars MsaccessLinks Process Controls Art Work Downloads msaccess How Tos Graph Charts msaccessQuery Array List Boxes Command Buttons Emails and Alerts Property Query Combo Boxes Custom Wizards DOS Commands Data Objects VBA ms-access functions msaccess functions msaccess graphs msaccess reporttricks Calculation Class Module Data Type msaccessprocess security advanced Access Security Custom Functions Macros Menus Object Reference Report Top Values Variables msaccess email msaccess menus progressmeter Access2007 Auto-Number Command Button Copy Expression Field Type Fields Form Form Instances Join Methods Microsoft Numbering System Records Security Split SubForm Table Utility Workgroup database msaccess wizards Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Conditional Formatting Controls Data Filtering Defining Pages Diagram Disk Dynamic Lookup Error Handler Excel Export External Filter Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Monitoring Octal Numbers Operating System Paste Primary-Key Product Rank Reading Recordset Rich Text Sequence SetFocus Summary Tab-Page Tables Time Difference Union Query User Users Water-Mark Word automatically commands function hyperlinks iSeries Date iif ms-access msaccess msaccess alerts pdf files reference restore switch text toolbar tutorial updating upload vba code

Featured Post

Base Class and Derived Object Variants

Last week we have tried an example as how to pass a Base Class Object, through the Set Property Procedure,  to become part of the Object in...

Labels

Blog Archive

Recent Posts