Option Explicit
'Add component to Microsoft HTML Object Library
'Add component Microsoft Internet Controls
'Add a command button (Command1)
'Add a web browser control to the form (wbbWebsite)
Dim hDoc 'As MSHTML.HTMLDocument
Dim hCol 'As MSHTML.IHTMLElementCollection
Dim hInp 'As MSHTML.HTMLInputElement
Dim hSub 'As MSHTML.HTMLInputButtonElement
Dim hTxt 'As MSHTML.HTMLInputTextElement
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
'Application.Screen.MousePointer = 11 ' Hourglass
'wbbWebsite.Navigate URL:="http://www.upcdatabase.com/nocheckdigit.pl"
'MsgBox "**** You"
'Application.Screen.MousePointer = 0 ' Back to normal
wbbWebsite.Navigate URL:="http://www.upcdatabase.com/item.pl?upc"
MsgBox "Hello"
End Sub
Private Sub Command1_Click()
wbbWebsite.Navigate URL:="http://www.upcdatabase.com/item.pl?upc"
MsgBox "Hello"
Set hDoc = wbbWebsite.Document
Set hInp = hDoc.getElementById("upc")
'hInp.focus
'upc = "064144043248"
hInp.Value = upc
Set hInp = Nothing
'Parse the elements and read the values of the data returned
'Set document variable = to the new results documents page
Set hDoc = wbbWebsite.Document
'Find the description:
'iStart = InStr(1, hDoc.body.innerHTML, "<TD>Description</TD>") + 37
'iEnd = InStr(iStart, hDoc.body.innerHTML, "</TD></TR>")
'MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
stDocName = "food"
DoCmd.OpenDataAccessPage stDocName, acDataAccessPageBrowse
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
Private Sub upc_Change()
wbbWebsite.Navigate URL:="http://www.upcdatabase.com/item.pl?upc"
MsgBox "Hello"
Set hDoc = wbbWebsite.Document
Set hInp = hDoc.getElementById("upc")
hInp.Value = upc
Set hInp = Nothing
End Sub