Skip to main content

AccessTr.neT


Access Form Kullanmadan Döviz Kuru Alma

Access Form Kullanmadan Döviz Kuru Alma

#17
buton kodlarını aşağıdaki kodla değiştirip dener misiniz? böyle daha hızlı oldu sanki
Dim Adrs As String
Dim ParaBirim As String
SorguTarihi = CDate(Me.TxtTrh.Value)

Set xmldoc = CreateObject("Msxml.DOMDocument")
Dim DovizListesi, Dovizler As Object
xmldoc.async = False


If SorguTarihi <> Date Then

Adrs = "http://www.tcmb.gov.tr/kurlar/" & CStr(Format(SorguTarihi, "yyyymm") & "/" & Format(SorguTarihi, "ddmmyyyy")) & ".xml"

Else

Adrs = "http://www.tcmb.gov.tr/kurlar/today.xml"

End If
If URLExists(Adrs) = False Then
MsgBox "bu tarihe ait kayıt yok"
Exit Sub
End If
xmldoc.Load Adrs
Set DovizListesi = xmldoc.DocumentElement.SelectNodes("Currency")
On Error Resume Next

Set baglan = CreateObject("adodb.connection")
baglan.Open "provider=Microsoft.ACE.OLEDB.12.0;data source=" & ThisWorkbook.Path & "\Döviz.accdb"

For Each Dovizler In DovizListesi
If Len(Dovizler.SelectSingleNode("BanknoteBuying").Text & "") = 0 Or Len(Dovizler.SelectSingleNode("BanknoteSelling").Text & "") = 0 Then
Exit For
End If
ParaBirim = Dovizler.SelectSingleNode("CurrencyName").Text

Select Case ParaBirim

Case "US DOLLAR"
txtDövizAdi = "USD"
Case "AUSTRALIAN DOLLAR"
txtDövizAdi = "AUD"
Case "DANISH KRONE"
txtDövizAdi = "DKK"
Case "EURO"
txtDövizAdi = "EUR"
Case "POUND STERLING"
txtDövizAdi = "GBP"
Case "SWISS FRANK"
txtDövizAdi = "CHF"
Case "SWEDISH KRONA"
txtDövizAdi = "SEK"
Case "CANADIAN DOLLAR"
txtDövizAdi = "CAD"
Case "KUWAITI DINAR"
txtDövizAdi = "KWD"
Case "NORWEGIAN KRONE"
txtDövizAdi = "NOK"
Case "SAUDI RIYAL"
txtDövizAdi = "SAR"
Case "JAPENESE YEN"
txtDövizAdi = "JPY"

End Select

SqlEkle = " INSERT INTO [Döviz] ([VeriTrh], DövizCinsi, DövizAdi, [DövizAlis], [DövizSatis],[EfektifAlis],[EfektifSatis]) " & _
" VALUES (" & CLng(SorguTarihi) & ",'" & txtDövizAdi & "','" & _
Dovizler.SelectSingleNode("Isim").Text & "'," & _
Dovizler.SelectSingleNode("ForexBuying").Text & ", " & _
Dovizler.SelectSingleNode("ForexSelling").Text & "," & _
Dovizler.SelectSingleNode("BanknoteBuying").Text & "," & _
Dovizler.SelectSingleNode("BanknoteSelling").Text & ")"

baglan.Execute SqlEkle

Next
Set xmldoc = Nothing
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Access Form Kullanmadan Döviz Kuru Alma - Yazar: berduş - 06/05/2020, 15:32