16/11/2019, 08:32
Merhaba aşağıdaki kodla veriyi tabloya çekiyorum, fakat sorgularda kullanamıyorum. Örneğin tabloda burce isimli bir olmasına rağmen sorgu satır döndürmüyor yomuş gibi. Veriyi silip elimle burce yazarsam sonuç dönüyor. çözüm arıyorum. yardımcı olurmusunuz.
----------sorgu -------
SELECT HisseVtGun.HISSE, HisseVtGun.FIYAT
FROM HisseVtGun
WHERE (((HisseVtGun.HISSE)="burce"));
-------------veriyi ceken kod --------------
Private Sub isyatirim()
On Error Resume Next
CurrentDb.Execute "DELETE * FROM [HisseVtGun] "
Dim IE As Object
Dim HTML_Body As Object, HTML_Tables As Object, MyTable As Object
Dim HTML_TableRows As Object
Dim S As String
Dim RetVal As Variant, X, A As Integer, SATIRSAYISI As Integer
Dim Sql As String
Dim rc As DAO.Recordset
Set rc = CurrentDb.OpenRecordset("HisseVtGun")
Set IE = Me.WebBrowser1
Set HTML_Body = IE.Document.all
Set HTML_Tables = HTML_Body.tags("table")
Set MyTable = HTML_Tables(2)
Set HTML_TableRows = MyTable.GetElementsByTagName("td")
For L = 0 To 600
If CInt(MyTable.rows(L).cells(1).innerText) < 0 Then GoTo 100
rc.AddNew
rc!HISSE = BoslukSil(MyTable.rows(L).cells(0).innerText)
rc!FIYAT = MyTable.rows(L).cells(1).innerText
rc!YUZDE = MyTable.rows(L).cells(2).innerText
rc!DEGISIM = MyTable.rows(L).cells(3).innerText
rc!hacIM = MyTable.rows(L).cells(4).innerText
rc!HACIMAD = MyTable.rows(L).cells(5).innerText
rc.update
100
Next L
Set rc = Nothing
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
---------hisse adındaki boşluğu silen kod--------
Public Function BoslukSil(ByVal GVeri As String) As String
If InStr(GVeri, Chr(160)) > 0 Then
BoslukSil = Replace(GVeri, Chr(160), "")
ElseIf InStr(GVeri, Chr(32)) > 0 Then
BoslukSil = Replace(GVeri, Chr(32), "")
Else
BoslukSil = GVeri
End If
End Function
----------sorgu -------
SELECT HisseVtGun.HISSE, HisseVtGun.FIYAT
FROM HisseVtGun
WHERE (((HisseVtGun.HISSE)="burce"));
-------------veriyi ceken kod --------------
Private Sub isyatirim()
On Error Resume Next
CurrentDb.Execute "DELETE * FROM [HisseVtGun] "
Dim IE As Object
Dim HTML_Body As Object, HTML_Tables As Object, MyTable As Object
Dim HTML_TableRows As Object
Dim S As String
Dim RetVal As Variant, X, A As Integer, SATIRSAYISI As Integer
Dim Sql As String
Dim rc As DAO.Recordset
Set rc = CurrentDb.OpenRecordset("HisseVtGun")
Set IE = Me.WebBrowser1
Set HTML_Body = IE.Document.all
Set HTML_Tables = HTML_Body.tags("table")
Set MyTable = HTML_Tables(2)
Set HTML_TableRows = MyTable.GetElementsByTagName("td")
For L = 0 To 600
If CInt(MyTable.rows(L).cells(1).innerText) < 0 Then GoTo 100
rc.AddNew
rc!HISSE = BoslukSil(MyTable.rows(L).cells(0).innerText)
rc!FIYAT = MyTable.rows(L).cells(1).innerText
rc!YUZDE = MyTable.rows(L).cells(2).innerText
rc!DEGISIM = MyTable.rows(L).cells(3).innerText
rc!hacIM = MyTable.rows(L).cells(4).innerText
rc!HACIMAD = MyTable.rows(L).cells(5).innerText
rc.update
100
Next L
Set rc = Nothing
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
---------hisse adındaki boşluğu silen kod--------
Public Function BoslukSil(ByVal GVeri As String) As String
If InStr(GVeri, Chr(160)) > 0 Then
BoslukSil = Replace(GVeri, Chr(160), "")
ElseIf InStr(GVeri, Chr(32)) > 0 Then
BoslukSil = Replace(GVeri, Chr(32), "")
Else
BoslukSil = GVeri
End If
End Function