- database solutions and downloads for microsoft access

Viewing a Live Web Page on a Microsoft Access Form

Using the Microsoft Access Web Browser Control

With so many companies and individuals having presence on the internet, it is more likely that your customers could have their own web sites. If we build a Microsoft Access table that will store our Customer information, this table can easily save each Customers web site address in a single field that stores the URL.

If we want to have immediate access to the web sites as you view your customer data in a Microsoft Access form, we can view it in a Web Browser control that we place on the form design.

If we want the Web Browser control to display the customer's Web site with the current record we need to add the code required to the forms OnCurrent event procedure.

The form below shows the completed Microsoft Access form showing the Web Browser control in action:

Microsoft Access form showing the Web Browser control
Microsoft Access form showing the Web Browser control

In the form design, we have added the Microsoft Web Browser control, which is an Active X control available from the toolbox » More Controls option.

After adding the control, we change the name of this in the Property sheet to wbbWebsite. Now we need to add the code to the form's OnCurrent event to determine what is displayed in the Web Browser control on the form.

Using the form's OnCurrent event we have included the following code:

Private Sub Form_Current()
'Navigate to the current record's Web site
'If there's no URL stored in the field, then display Google search engine.
    If Len([CompanyWebsite]) > 0 Then
            wbbWebsite.Navigate URL:=[CompanyWebsite]
            wbbWebsite.Navigate URL:=""
    End If
End Sub

What this will do is check the [CompanyWebsite] field that is included in the Microsoft Access table to ensure that the length Len([CompanyWebsite]) > 0 , if so the web browser control (wbbWebsite) will navigate to the URL displayed in the CompanyWebsite field.

Using the If...Then...Else statement, we are checking if the CompanyWebsite field length is greater than zero, if not we will display a default web page (

There is a Microsoft Access 2000 Database example available to download from the Microsoft Access Forms page or from the Microsoft Access Downloads section of the web site.

This example assumes that you have a current internet connection, and it should be noted that there is no error checking routines in place to prevent opening the form without this current connection being live.