This documentation is archived and is not being maintained.

AddToFavorites Method [Access 2003 VBA Language Reference]

Office 2003

The AddToFavorites method adds a hyperlink address to the Favorites folder.

expression.AddToFavorites

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

When applied to the Application object, the AddToFavorites method adds the name of the current database to the Favorites folder. For example, if you're working in the Northwind sample database, applying the AddToFavorites method to the Application object adds the hyperlink address of the Northwind database to the Favorites folder.

When applied to a Control object, the AddToFavorites method adds the hyperlink address contained in a control to the Favorites folder.

The AddToFavorites method has the same effect as clicking AddToFavorites on the Favorites menu on the Web toolbar when the document whose address you wish to add is open.

Example

The following example sets the HyperlinkAddress property of a command button. When the user clicks the command button, the address is added to the Favorites folder by using the AddToFavorites method.

To try this example, create a new form and add a command button named Command0. Paste the following code into the form's module. Switch to Form view and click the command button.

Private Sub Form_Load()
    Me!Command0.HyperlinkAddress = "http://www.microsoft.com/"
End Sub
		
Private Sub Command0_Click()
    Me!Command0.Hyperlink.AddToFavorites
End Sub
		




Show: