Monday, September 17, 2018

Add Web browsing to a form

Add Web browsing to a form

Access includes a new Web Browser Control that allows you to display Web pages on a form. You can link the control to fields or controls in your database to dynamically determine which page is displayed. For example, you can use address information in a database to create custom maps on an Internet mapping site, or you can use product information in a database to search for items on a supplier's Web site.

Note: This article doesn't apply to Access web apps – the kind of database you design with Access and publish online.

Add a Web Browser Control to a form

Change the position and size of the Web Browser Control

Modify the control source of a Web Browser Control

Add a Web Browser Control to a form

Adding a Web Browser Control to a form is similar to the process of adding other controls, such as text boxes or command buttons. The main difference is in how you create the control source for the control. Instead of an expression or object name, the control source for a Web Browser Control is a Web page URL. Use the following procedure to get started.

  1. In the Navigation Pane, right click the form to which you want to add a Web Browser Control, and then click Layout View.

  2. On the Design tab, in the Controls group, click Web Browser Control.

  3. Position the pointer where you want the control, and then click to place it.

    Access opens the Insert Hyperlink dialog box.

    Insert Hyperlink dialog box

    You can type the base URL, paths, and parameters directly into the boxes, but the easiest way to enter the URL is to browse to the site, copy the address, and then let Access parse the address into its component parts. Use the following steps to accomplish this task:

  4. Click the Browse the Web button to the right of the Address box.

  5. In your Web browser, navigate to the page you want displayed in the control. If the page you want to display is a "results" page of a search engine, then get that page to display by entering a typical search term and searching for it.

  6. When the page you want is displayed in your browser, copy the URL from the address bar, and then close the browser.

  7. In the Insert Hyperlink dialog box, paste the URL into the Address box, and then press the TAB key.

    Access clears the Address box, and separates the URL into the appropriate boxes: Base URL, Paths, and Parameters. The complete URL is displayed in a box below the Paths and Parameters lists.

  8. If you want to display the same Web page regardless of what data is displayed on the form, click OK in the Insert Hyperlink box and continue with the next section. Otherwise, continue with the next step.

  9. To set the Web Browser Control so that its URL changes based on the data that is displayed on your form, you must replace the appropriate URL components with expressions that refer to the appropriate controls on the form. For each component that you want to replace:

    1. Click the path or parameter that you want to replace, and then click the Build button Button image .

    2. In the Expression Builder dialog box, if the element lists are not displayed, click More >> to display them.

    3. In the element lists, find the control that contains the data you want to be substituted for that path or parameter, and then double-click it to add it to the expression box.

    4. If there are any other calculations that must be done with the value, add the necessary operators and expression elements, and then click OK to close the Expression Builder.

  10. Click OK in the Insert Hyperlink dialog box.

If you are having trouble constructing the correct URL for a particular site, you might need to consult the Help or support pages of that site for further information about how to build a URL.

For more information about creating an expression, see the articles Build an expression or Use the Expression Builder.

Top of page

Change the position and size of the Web Browser Control

When you first place the Web Browser Control on a form, it might occupy a fairly small cell in a layout. In most cases, you will need to adjust the layout to show as much of the Web page as possible. A good way to get started is to merge the cell that contains the control with adjacent empty cells:

  1. Select the cell that contains the Web Browser Control.

  2. Hold down the CTRL key and select any empty adjacent cells that you want the control to occupy.

  3. On the Arrange tab, in the Merge / Split group, click Merge.

  4. Resize the resulting cell by selecting it and dragging its edges until it is the size you want.

Top of page

Modify the control source of a Web Browser Control

After adding a Web Browser Control to a form, you might need to make further modifications to its control source (URL). Use the following procedure to open the Insert Hyperlink dialog box so that you can make changes.

  1. In the Navigation Pane, right click the form to that contains the Web Browser Control, and then click Layout View.

  2. Right-click the Web Browser Control, and then click Build Hyperlink.

  3. In the Insert Hyperlink dialog box, make the necessary changes to the URL components, and then click OK.

Top of page

No comments:

Post a Comment