www.upcdatabase.com-VBForums
Results 1 to 1 of 1

Thread: www.upcdatabase.com

  1. #1

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    917

    Angry www.upcdatabase.com

    Hi
    The www.upcdatabase.com has been update.
    Can you all update my code for me?
    vb Code:
    1. Dim strConn As String
    2. Dim strSQL As String
    3. Dim cn
    4. Dim rs
    5. Dim hDoc As MSHTML.HTMLDocument
    6. Dim hCol As MSHTML.IHTMLElementCollection
    7. Dim hInp As MSHTML.HTMLInputElement
    8. Dim hSub As MSHTML.HTMLInputButtonElement
    9. Dim hTxt As MSHTML.HTMLInputTextElement
    10.  
    11. Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    12.  
    13. Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
    14. 'ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum,
    15. 'ByVal pRecordset As ADODB.Recordset)
    16. Text1 = "Record " & Adodc1.Recordset.AbsolutePosition _
    17.         & " of " & Adodc1.Recordset.RecordCount
    18. End Sub
    19.  
    20. Private Sub Command1_Click()
    21. Dim ADOCn As ADODB.Connection
    22. Dim ConnString As String
    23. Dim sSQL As String
    24. Dim iStart As Integer
    25. Dim Text
    26.     Dim iEnd As Integer
    27.     iStart = 0
    28.     iEnd = 0
    29.  
    30. ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    31.         "Data Source= C:\Users\bob\Desktop\UPC\games.mdb;" & _
    32.         "Persist Security Info=False"
    33.  
    34. Set ADOCn = New ADODB.Connection
    35. ADOCn.ConnectionString = ConnString
    36. ADOCn.Open ConnString
    37. Do While WebBrowser1.Busy = True
    38.         DoEvents
    39.         Sleep 500
    40.     Loop
    41.     Set hDoc = WebBrowser1.Document
    42.     Set hInp = hDoc.getElementById("upc")
    43.     'hInp.focus
    44.     'hInp.Value = "02881920"
    45.     'SendKeys "{ENTER}", True
    46.     Do While WebBrowser1.Busy = True
    47.         DoEvents
    48.         Sleep 500
    49.     Loop
    50. Set hInp = Nothing
    51.     'Parse the elements and read the values of the data returned
    52.     'Set document variable = to the new results documents page
    53.     Set hDoc = WebBrowser1.Document
    54.     'Find the UPC
    55.     iStart = InStr(1, hDoc.body.innerHTML, "<TD>UPC</TD>") + 37
    56.     iEnd = InStr(iStart, hDoc.body.innerHTML, "</TD></TR>")
    57.     MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    58.     Text1.Text = Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    59.     'Find the description:
    60.     iStart = InStr(1, hDoc.body.innerHTML, "<TD>Description</TD>") + 37
    61.     iEnd = InStr(iStart, hDoc.body.innerHTML, "</TD></TR>")
    62.     MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    63.     Text2.Text = Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    64.     'Find the Size/Weight:
    65.     iStart = InStr(iStart, hDoc.body.innerHTML, "<TD>Size/Weight</TD>") + 37
    66.     iEnd = InStr(iStart, hDoc.body.innerHTML, "</TD></TR>")
    67.     MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    68.     Text3.Text = Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    69.     'Find Manufacturer:
    70.     'iStart = InStr(iStart, hDoc.body.innerHTML, "<TD>Manufacturer</TD>") + 38
    71.     'iEnd = InStr(iStart, hDoc.body.innerHTML, "(<A href=")
    72.     'MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    73.     'Text4.Text = Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    74.     'Find the Entered/Modified:
    75.     'iStart = InStr(iStart, hDoc.body.innerHTML, "<TD>Entered/Modified</TD>") + 42
    76.     'iEnd = InStr(iStart, hDoc.body.innerHTML, "</TD></TR>")
    77.     'MsgBox Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    78.     'Text5.Text = Mid$(hDoc.body.innerHTML, iStart, iEnd - iStart)
    79. sSQL = "INSERT INTO table " & "(UPC, Description) VALUES ('" & Text1.Text & "', '" & Text2.Text & "')"
    80. Debug.Print sSQL
    81. 'ADOCn.Execute sSQL
    82. End Sub
    83.  
    84. Private Sub Form_Load()
    85.     WebBrowser1.Navigate2 "http://www.upcdatabase.com/itemform.asp"
    86. Set cn = New ADODB.Connection
    87. Set rs = New ADODB.Recordset
    88. 'Dim strConn As String
    89. 'Dim strSQL As String
    90. 'strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Brandon Crocker\Desktop\SALES 1\SALES 1\Database.mdb;Persist Security Info=False"
    91. 'strSQL = "SELECT * FROM MemberDetails"
    92. End Sub
    Last edited by Hack; Dec 20th, 2010 at 08:53 AM. Reason: Added Highlight Tags
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.