Introduction.
Hyperlinks are everywhere on the Internet, and Microsoft Access supports them, too. In Access, hyperlinks can be used to open objects—such as Tables, Forms, Reports, or Queries—with a simple click, without writing a single line of VBA code or creating a Macro. They can also be created in Tables or Forms to build menus that open various database objects. Beyond Access, hyperlinks can be used to launch external files such as Word documents, Excel worksheets, PDFs, text files, and more.
In Access, hyperlinks can be created or edited manually by entering their different segments in the correct order, either in a table field or on form controls. More commonly, editing is done through the Edit Hyperlink dialog box, which appears when you right-click on a hyperlink control. 4 Segments of Hyperlink-Address in MS-Access.
The Hyperlink address line is divided into four segments:
- Display Text: the text that appears in a field or control, indicating the hidden link's purpose
- Address: external file's path-name
- Sub-Address: Internal Object Name, to open Form, Report, etc.
- Screen-tip: the text displays as a tooltip.
Hyperlink syntax is as follows:
Display Text#Address#Sub-Address#Tool-tip text
The Hyperlink Data type field can store a maximum of 2048 characters.
You can find more details and usage of Hyperlinks in the earlier Post: Open Forms with Hyperlinks in Listbox.
Editing Hyperlink Manually.
Let us get into the manual editing of the Hyperlink topic:
We will create a sample table with a Hyperlink field to try out the manual editing exercise.
- Create a table with a single field and data type Hyperlink.
- Save the table with a name.
- Open the table in datasheet view.
If you know how to enter Hyperlink data into the field manually, you may do so by following the hyperlink syntax shown below.
Example: My Excel File#C:\\\My Documents\Workbook1.xls##Click
- After entering the sample hyperlink in the field, open the table in the datasheet view.
You will see that the hyperlink field is active, and the only text showing is the Display Text (My Excel File) part of the hyperlink information.
- Move the mouse pointer over the field, and it changes the mouse pointer to a hyperlink pointer (a Hand with an index finger).
If you click on the field to edit the hyperlink information, it will only open the document specified in the second segment.
If you right-click on the field, the shortcut menu, which carries the hyperlink editing options in a dialog box, is displayed. You may key in values at appropriate controls to change the hyperlink values. You cannot type values directly into the hyperlink field.
Simple Trick to Edit Hyperlink Manually.
But we can manually edit the field with a simple trick.
- Close the Table for now.
- Click on the Office Button.
- Select Access Options.
- Select Advanced.
- Find the Behavior Entering Field options.
- Select Go to end of the field option.
- Click OK to close the Access Options control.
- Open the Table after completing the above steps.
You can see that the insertion point is positioned at the end of the field value, exposing the hyperlink information. Move the insertion point back to the location where you need to edit the field.
If you have more than one record to edit, then change them and reset the Behavior Entering Field option to Select Entire Field.
TIP:
If you would like to show the full Pathname of the File as display text, then copy the second segment hyperlink value and paste it into the display text position also.
Stand-alone Label Controls Have Hyperlink Properties.
The Label control on the Form can be used as a hyperlink control. The label control has Hyperlink Address & Hyperlink Sub-Address properties; use the Caption property to set the Display Text value of the hyperlink. Set the Special Effect property value to Raised, to make it look like a Command Button.
No comments:
Post a Comment
Comments subject to moderation before publishing.