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:

Microsoft Access Tutorial Database

During installation of Microsoft Access 2003 or earlier versions, the NorthWind.mdb sample database also will be installed on your computer automatically. The sample database is very helpful for those who are starting with their self learning practices of Microsoft Access.

Those who are migrating from Microsoft Excel Worksheets and tables are created in line with what they have practiced in Worksheets, find themselves faced with lot of issues. In fact, Excel itself have database management support, even though they are not as flexible as Microsoft Access. Excel Users can browse for database basics in Excel Help documents to set up a database in Excel and learn simple data organizing & retrieval methods, like sorting, searching, filtering and so on. This not only helps to learn database basics but also will help to organize Excel worksheet/database in such a way that they can be easily linked/imported into Microsoft Access, if need arises at a later stage.

Coming back to the sample database creation in Microsoft Access 2007, it doesn't create a sample database (Northwind.accdb) automatically in your computer. But, you can create one yourself from the sample Templates provided. It contains all the tutorial materials you need to learn Microsoft Access.

  1. Open Microsoft Access 2007

    You will find several Database Template Categories displayed at the left panel and Featuring Category is selected by default. In the middle window, the template  Blank Database displayed and other templates designed for specific purposes.

  2. On the left panel find the Sample Template category and select it.
  3. Click on the Northwind 2007 Template.

    The database will be saved in the active folder by default. You may change the folder by clicking on the folder icon to the right of the database file name.

  4. Click Create Button to create the sample database in your preferred folder specified.

Always use the sample database as a reference point for all your issues regarding Table designing, setting up Relationships, Queries, Forms, Reports and Macros designing. Do few trial and error practices on the specific task you are trying to accomplish, with whatever knowledge and ideas you have. You will get better insight into the task you are trying to design and you can find solutions in most cases yourself. If you are not able to do it then with the trial-and-error background you will be in a better position to explain your specific issues and seek help from other sources.

You can search this Website for topics you are interested in or post your questions and get help from experts in Microsoft Access Users' Forums on Internet. Links to some of the popular Forum Websites are given below:

  1. http://www.access-programmers.co.uk/forums/
  2. http://www.dbforums.com/forumdisplay.php?84-Microsoft-Access
  3. http://www.accessforums.net/#access-forums
  4. http://www.mrexcel.com/forum/microsoft-access/
Share:

Designing About Form for MS-Access Project

Your Microsoft Access Application development process is complete and ready to install for the User. At this stage you may design a small form known as About Form for your Project. About form will display the customized Logo and the name of the Project, Version Number, Copy Rights information and other details, which you may wish to include on the form.

Sample About Form image of Windows Live writer Application is given below:

Designing an About Form is easy. You need two Label controls to display the Application Name & Current Version Number, one Textbox to display the Copy Rights information. If you have designed a Logo, to give a unique identity to your Application, then that also can be included on the About Form.

Let us design such a small About Form, to know what it takes to create one with a simple Logo. Our sample About Form in design view is given below for reference.

I have designed a simple logo in MS-Word, captured a screenshot of it, modified in MS-Paint and saved as a .bmp file.

  1. Open your Microsoft Access Application.
  2. Create a new Blank Form.
  3. Set the Width Property value of the Form to 3.93".
  4. Click on the Detail Section of the Form to select it.
  5. Set the Height property value to 1.53".
  6. Insert an Image control at the left side of the Form and select the Project Logo image from your computer. You may select the  the Picture Property of the Image control and click on the build () button to browse and select the logo image from your computer, if you wish to change the image later.
  7. Set the Image property values as given below:
    • Picture Tiling : No
    • Size Mode : Zoom
    • Picture Alignment : Center
    • Picture type : Embedded
  8. Insert a Label control to the right of the logo and top of the Form, re-size it to make it wide enough to write the Application name in bold letters.
  9. Write the name of your Project in the Caption property, change the font size big enough to your liking, make it bold and align the text to the center.
  10. Create another Label control below the first one, with the same width of the first label, and write the Version number of your Project, make it bold and align the text to the center.
  11. Insert a Textbox below the earlier labels, change it's width as wide as the top labels.
  12. Copy and paste the following expression into the Control Source property of the textbox.
    ="Copyright " & Chr$(169) & Year(Date()) & " All Rights Reserved".
    
  13. Change the following property values of the text box as given below:
    • Border Style : Transparent
    • Text Align : Center
    • Enabled : No
    • Locked : Yes
    • Tab Stop : No
  14. Create a Command Button below the textbox and position it to the center horizontally.
  15. Make the following changes to the Command Button:
    • Change the Name property value to cmdOK.
    • Change the Caption property value to OK.
    • Click on the Event Tab of the property sheet.
    • Select the On Click property and select [Event Procedure] from the drop-down list.
    • Click on the Build (...) button to open the VBA Module with the empty procedure start and end lines.
    • Copy the middle line of the Code given below and paste the line in the middle of the start and end lines of the VBA procedure (Private Sub cmdOK_Click() . . . End Sub). Or copy all the three lines and paste it, overwriting the existing lines in the VBA Module.
    • Private Sub cmdOK_Click()
      DoCmd.Close
      End Sub
      

      When the User clicks on the Command Button the above Code will run and the About Form will be closed.

  16. Save the Form and rename it as About or frmAbout.

  17. Open the Form in normal View and see how it looks.

    As you can see the Form needs changes to make it's appearance like a real About Form. Let us do that to give it the final touches.

  18. Make the following changes in the Form's Property Values as shown below:
    • Caption : About <your Project name here>
    • Pop Up : Yes
    • Modal : Yes
    • Default View : Form View
    • Allow Form View : Yes
    • Auto Center : Yes
    • Auto Resize : Yes
    • Fit to Screen : No
    • Border Style : Dialog
    • Record Selectors : No
    • Navigation Buttons : No
    • Dividing Lines : No
    • Scroll Bars : Neither
    • Control Box : Yes
    • Close Button : No
    • Min Max Button : None
  19. Save the Form after the above changes.
  20. Open the About form in Normal View.

    Image of the completed About Form in normal view is given below.

You must add a option in your Customized Menu of your Project to enable the User to open the About Form, if he/she wish to do so. Or you may add a Command Button on the Main Form of your Project to open the About form.

Share:

Translate



PageRank
Your email address:

Delivered by FeedBurner

Search

Infolinks Text Ads


Blogs Directory

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 Menus and Toolbars Accesstips MsaccessLinks Process Controls Art Work Downloads msaccess How Tos Graph Charts msaccessQuery List Boxes Command Buttons Emails and Alerts Query Combo Boxes Custom Wizards DOS Commands ms-access functions msaccess functions msaccess graphs msaccess reporttricks msaccessprocess security advanced Access Security Array Custom Functions Data Macros Menus Property Report Top Values VBA msaccess email msaccess menus progressmeter Access2007 Auto-Number Command Button Copy Form Join Microsoft Numbering System Records Security Split SubForm Table Utility Variables Workgroup database msaccess wizards Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting Calculation ChDir Color Palette Conditional Formatting Controls Data Filtering Data Type Defining Pages Diagram Disk Dynamic Lookup Error Handler Excel Export Expression External Field Type Fields Filter Form Instances Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Methods Monitoring Object Reference Objects 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

Function Parameter Array Passing

Last week we have explored the usage of ByVal (By Value) and ByRef (By Reference),  in the Function Parameter, to pass the value from  a Va...

Labels

Blog Archive

Recent Posts