|
|
|
|
|
|
Access
|
Form based Web Viewer
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2003
|
Submitted by:
|
Brandtrock
|
Description:
|
This entry illustrates how to view webpages on a userform. The combobox at the top of the userform allows the user to select a site from the company data table. The web window allows normal surfing of the site selected.
|
Discussion:
|
The ActiveX web browser control on the main form is directed to a user selected URL through the combobox selection at the top of the form. If a URL is included in the Company Data table, the form displays the URL. If no URL is associated with an entry, the Google search page is displayed. Additional or different websites are included by changing the information in the Company data table.
|
Code:
|
instructions for use
|
Option Compare Database
Option Explicit
Private Sub CompanyWebsite_AfterUpdate()
On Error Resume Next
If Len(Me!CompanyWebsite) > 0 Then
Me!wbbWebsite.Navigate Me!CompanyWebsite
End If
End Sub
Private Sub Form_Current()
If Len([CompanyWebsite]) > 0 Then
wbbWebsite.Navigate URL:=[CompanyWebsite]
Else
wbbWebsite.Navigate URL:="www.google.com"
End If
End Sub
Private Sub cboSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CompanyID] = " & Str(Me![cboSearch])
Me.Bookmark = rs.Bookmark
Me.cboSearch = ""
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Formatting (Form/Report)", acToolbarNo
End Sub
|
How to use:
|
- 1. The best way to use this is to open the attached example.
- 2. When the Company Display form is launched go to Window and select VBAX WebForm : Database to switch to the database pane.
- 3. Select Tables.
- 4. Double Click tblCompany.
- 5. Edit the company names and url's as desired.
- 6. Save the file.
- 7. Close the file.
- 8. Now the database is set for your use.
- 9. Relaunch the file and surf to your heart's content.
|
Test the code:
|
- 1. Launch the example file.
- 2. The startup form will display.
- 3. Select a company name from the top box on the userform.
- 4. In the display window, you can surf to your heart's content.
|
Sample File:
|
VBAX WebviewerForm.zip 18.02KB
|
Approved by mdmackillop
|
This entry has been viewed 393 times.
|
|