- Katılım
- 12 Şubat 2015
- Mesajlar
- 520
- Excel Vers. ve Dili
- Office 2016 TR 64 Bit Windows
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub Test()
Dim adoCN As Object, SourceFile As String, strSQL As String
Range("E2:E" & Rows.Count) = ""
Set adoCN = CreateObject("ADODB.Connection")
SourceFile = ThisWorkbook.Path & "\SiparislerDBO.accdb"
adoCN.Provider = "Microsoft.ACE.OLEDB.12.0"
adoCN.ConnectionString = SourceFile
adoCN.Open
strSQL = " Select T2.[UrunAd] From [Excel 12.0;HDR=Yes;Database=" & ThisWorkbook.FullName & "].[Giris$] As T1 " _
& " Inner Join " _
& " [SiparisTBL] As T2 " _
& " On (Cstr(T1.[Siparis No]) = T2.[SiparisNo]) " _
& " Where T1.[Siparis No] Is Not Null"
Set RS = adoCN.Execute(strSQL)
Range("E2").CopyFromRecordset RS
adoCN.Close
Set adoCN = Nothing
End Sub