14/04/2011, 20:34
ozanakkaya
Sorudan anladığım kadarıyla
şeklinde kod kullanılmalı.
Sub WebVeri()
On Error Resume Next
Dim IE As Object
Dim HTML_Body As Object, HTML_Tables As Object, MyTable As Object
Dim HTML_TableRows As Object
Dim RetVal As Variant, X, A As Integer, SATIRSAYISI As Integer
Set IE = Me.WebBrowser1
Set HTML_Body = IE.Document.All
Set HTML_Tables = HTML_Body.tags("Table")
Set MyTable = HTML_Tables(41)
Set HTML_TableRows = MyTable.GetElementsByTagName("tr")
For Each MyRow In HTML_TableRows
X = X + 1
Next
SATIRSAYISI = (X - 2) / 1
ReDim Sorgu(7, SATIRSAYISI - 1)
X = 0
For X = 0 To SATIRSAYISI - 1
A = 2 + (1 * X)
If MyTable.Rows(A).Cells(6).innerText = Empty Then
Sorgu(0, X) = MyTable.Rows(A - 1).Cells(0).innerText
Sorgu(1, X) = MyTable.Rows(A - 1).Cells(1).innerText
Sorgu(2, X) = MyTable.Rows(A).Cells(0).innerText
Sorgu(3, X) = MyTable.Rows(A).Cells(1).innerText
Sorgu(4, X) = MyTable.Rows(A).Cells(2).innerText
Sorgu(5, X) = MyTable.Rows(A).Cells(3).innerText
Sorgu(6, X) = MyTable.Rows(A).Cells(4).innerText
Sorgu(7, X) = MyTable.Rows(A).Cells(5).innerText
Else
Sorgu(0, X) = MyTable.Rows(A).Cells(0).innerText
Sorgu(1, X) = MyTable.Rows(A).Cells(1).innerText
Sorgu(2, X) = MyTable.Rows(A).Cells(2).innerText
Sorgu(3, X) = MyTable.Rows(A).Cells(3).innerText
Sorgu(4, X) = MyTable.Rows(A).Cells(4).innerText
Sorgu(5, X) = MyTable.Rows(A).Cells(5).innerText
Sorgu(6, X) = MyTable.Rows(A).Cells(6).innerText
Sorgu(7, X) = MyTable.Rows(A).Cells(7).innerText
End If
Next X
Dim rc As DAO.Recordset
Set rc = CurrentDb.OpenRecordset("tbl_bebek")
X = 0
For X = 0 To SATIRSAYISI - 1
rc.AddNew
rc![BEBEĞİNTCKİMLİKNOSU] = Sorgu(0, X)
rc![BEBEĞİNADISOYADI] = Sorgu(1, X)
rc![ASININADI] = Sorgu(2, X)
rc![YAPILABİLECEĞİİLKTARİH] = Sorgu(3, X)
rc![YAPILDIĞITARİH] = Sorgu(4, X)
rc![YAPILABİLECEĞİSONTARİH] = Sorgu(5, X)
rc![GEREKEN] = Sorgu(6, X)
rc![YAPILAN] = Sorgu(7, X)
rc.Update
Next X
Set rc = Nothing
Me![tbl_bebek alt formu].Requery
GoTo SafeExit:
'ErrHandler:
SafeExit:
Set HTML_Body = Nothing
Set HTML_Tables = Nothing
Set MyTable = Nothing
Set HTML_TableRows = Nothing
Set HTML_TableDivisions = Nothing
Set IE = Nothing
End Sub
şeklinde kod kullanılmalı.