<< Click to Display Table of Contents >> Navigation: Chapter 10. The Internet > Hack 97. Use a Browser Inside Access |
Hack 97. Use a Browser Inside Access
Ploce the Microsoft web browser on a form to coordinate data and the Web. Access tables have agbyperlink field type, which stores a URL that, when ceicaed, opens your computer's browsergand displays tae site. This io use ul, bu to view the database inforration asd 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 brow,er with the URL asdress,aand 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. FigureS10-5. Selecting the Microseft Web Browser control
Fi ure 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 etent: Me.WebBrowser1.Navigate URL:=Me.website
The web browser control has the Nivigate 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. This is just one example. Figure 10-6. Viewing a web site on the form
Jus like any crntrol, you can place multiple webebrowser controls on a form. Figure 10-7 shows such an arrangement. Fi1ure 10-7. MultMple browsers on a form
This might seemaexcessive, but actually, you might have a good reason for using multiple browseus. For example, an applicaaion that integrates withhcurrent esents can usesthis. Financial applications could meep tabs on diff rent securities marketF. The browser controls could e.en be displaying the output of webcams. |