Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2009
    Posts
    22

    Question Unanswered: How can I HTML Importing ??

    I have dB access and HTML .......
    How can I Importing HTML by code ?????



    This is attachment .......
    Attached Files Attached Files
    Last edited by mhb300; 01-07-09 at 13:50.

  2. #2
    Join Date
    Jan 2009
    Posts
    22

    Question

    There are explained in the attachment
    Last edited by mhb300; 01-07-09 at 12:23.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    and well you may say ....................
    what do you want to do
    what are you getting stuck on
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Jan 2009
    Posts
    22
    I want code for Importing HTML .... because I tried but I did not succeed

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    importing HTML from where?
    what did you try?
    Im not sure I'd know how to import HTML from a HTML stream. presumably its possible using a TCP/IP socket and fake the HTL request protocol.

    BTW im not going to open any attachment if I don't know its origin.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jan 2009
    Posts
    22
    The attachment is dB access .... from me.


    Sir for example .....

    we have this link:
    Area Code Listing, by Number

    and I want importing to my dB in Table by command in form .....


    This is Form
    http://img412.imageshack.us/img412/2873/77197209ro2.png

    When you press the button all the "data" comes


    I want after the execution of the order thus becomes.
    This is Table
    http://img101.imageshack.us/img101/9066/48921775pi9.png

    I hope I explained the meaning...
    Please forgive my failure to language
    Last edited by mhb300; 01-07-09 at 13:09.

  7. #7
    Join Date
    Jan 2009
    Posts
    22
    I have code for that but I can not try it because it has error

    Code:
    Dim conn As ADODB.Connection
    
    Set conn = New ADODB.Connection
    Call conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                   "Data Source=http://www.bennetyee.org/ucsd-pages/area.html;" & _
                   "Extended Properties=""HTML Import;HDR=YES;IMEX=1""")
    
    Dim rs As ADODB.Recordset
    
    Set rs = New ADODB.Recordset
    Call rs.Open("select count(*) from [Area Code Listing, by Number]", conn, adOpenDynamic, adLockReadOnly)
    Debug.Print rs.Fields(0).Value
    Call rs.Close
    Or this

    Code:
    Dim db As DAO.Database
    Dim td As DAO.TableDef
    
    ' Assumes we're in Access and adding the linked TableDef to the current database.  You could
    ' do this external to Access, but you'd have to create a Connection and open the DataBase yourself.
    
    Set db = CurrentDb()
    
    Set td = db.CreateTableDef("AreaCodes")
    td.Connect = "HTML Import;HDR=YES;IMEX=1;DATABASE=http://www.bennetyee.org/ucsd-pages/area.html"
    td.SourceTableName = "Area Code Listing, by Number"
    Call db.TableDefs.Append(td)
    
    Dim rs As DAO.Recordset
    
    Set rs = db.OpenRecordset("select count(*) from AreaCodes")
    Debug.Print rs.Fields(0).Value
    Call rs.Close
    Or this

    Code:
    Dim conn  As ADODB.Connection
    
    Set conn = New ADODB.Connection
    Call conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\whatever\somefile.mdb")
    
    Dim cat   As ADOX.Catalog
    Dim table As ADOX.table
    
    Set cat = New ADOX.Catalog
    Set cat.ActiveConnection = conn
    
    Set table = New ADOX.table
    With table
      .Name = "AreaCodes"
      Set .ParentCatalog = cat
      .Properties("Jet OLEDB:Create Link").Value = True
      .Properties("Jet OLEDB:Link Provider String").Value = "HTML Import;HDR=YES;IMEX=1;DATABASE=http://www.bennetyee.org/ucsd-pages/area.html"
      .Properties("Jet OLEDB:Remote Table Name").Value = "Area Code Listing, by Number"
    End With
    
    Call cat.Tables.Append(table)
    
    Dim rs As ADODB.Recordset
    
    Set rs = New ADODB.Recordset
    Call rs.Open("select count(*) from AreaCodes", conn, adOpenDynamic, adLockReadOnly)
    Debug.Print rs.Fields(0).Value
    Call rs.Close
    
    Call conn.Close

    this is from her

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    and what is the error
    what have you done to debug the script
    did you try going back to the perosn who wrote this VBA and ask them what to do?
    I'd rather be riding on the Tiger 800 or the Norton

  9. #9
    Join Date
    Jan 2009
    Posts
    22
    I say again .... How can I get data from web to my dB ???


    I tride this code but I did not succeed
    Code:
    Dim WebConn As New ADODB.Connection
    Dim RstGetData As New ADODB.Recordset
    
    WebConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=http://www.bennetyee.org/ucsd-pages/area.html;Extended Properties=""HTML Import;HDR=YES;IMEX=1"""
    RstGetData.Open "SELECT [Area Code Listing, by Number].[Area Code], [Area Code Listing, by Number].Region, [Area Code Listing, by Number].[Timezone Offset (from UTC)], [Area Code Listing, by Number].Description FROM [Area Code Listing, by Number];", WebConn, adOpenDynamic, adLockReadOnly
    RstGetData.MoveFirst
    
    Do Until RstGetData.EOF
      Debug.Print RstGetData![Area Code]
      Debug.Print RstGetData!Region
      Debug.Print RstGetData![Timezone Offset (from UTC)]
      Debug.Print RstGetData!Description
      RstGetData.MoveNext
    Loop
    
    RstGetData.Close
    The error is this in picture
    http://img242.imageshack.us/img242/2099/67027121ww6.png

    and this
    http://img165.imageshack.us/img165/3176/64781522ga2.png

    I do not understand what happened !!!
    May I ask for your help.

  10. #10
    Join Date
    Jan 2009
    Posts
    22

    Red face

    I tried with another code but same problem...!!!!!!!!!!

    Look at the picture
    http://img296.imageshack.us/img296/2356/10739491hf2.png


    I want to import an HTML page from the Web to a dB access by the code

    This is a HTML page
    Area Code Listing, by Number
    Attached Files Attached Files
    Last edited by mhb300; 01-08-09 at 16:44.

Posting Permissions

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