Hack #97. Use a Browser Inside Access

Place the Microsoft web browser on a form to coordinate data and the Web.

Access tables have a hyperlink field type, which stores a URL that, when clicked, opens your computer's browser and displays the site. This is useful, but to view the database information and the web site together is a challenge. You might have to reduce the size of both Access and the browser so that they fit together on your computer screen.

This hack puts the browser right on the Access form. To view the web site at the stored URL, you just load the browser with the URL address, and the web site appears on the form.

Figure 10-5 shows a form in Design mode. The Microsoft Web Browser control (one of the items in the list of More Controls that is available from the button on the toolbox) has been placed on the form.

Selecting the Microsoft Web Browser control

Figure 10-5. Selecting the Microsoft Web Browser control

Figure 10-6 shows the form in View mode.

The browser control displays the web site listed in the current record. This occurs when you click the Display Web Site button, which has this line of code in its Click event:

   Me.WebBrowser1.Navigate URL:=Me.website

The web browser control has the Navigate method, and it navigates to the supplied URL. In this example, the URL comes from the website field on the form, from the current record. Of course, you can feed a URL to the web browser control in other ways. ...

Get Access Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.