Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub test()
- ' On Error Resume Next
- Const adOpenStatic = 3
- Const adLockOptimistic = 3
- Const adCmdText = &H1
- Set objConnection = CreateObject("ADODB.Connection")
- Set objRecordset = CreateObject("ADODB.Recordset")
- objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=\\POEL5-DATEN\Altona-Büro-Dateien\11 Büroteam\Joe Koenig\Excel Übungen\Kunden.xlsx;" & _
- "Extended Properties=""Excel 8.0;HDR=Yes;"";"
- ' objRecordset.Open "Select * from [Tabelle2$] where farbe is not null ", objConnection, adOpenStatic, adLockOptimistic, adCmdText
- 'objRecordset.Open "Select farbe, count(*) from [Tabelle2$] group by farbe having count(*) > 2 ;", _
- ' objConnection, adOpenStatic, adLockOptimistic, adCmdText
- objRecordset.Open "SELECT KdID, sum(Umsatz) from [Kunden$] INNER JOIN [Umsatz$] on [Kunden$].KdID=[Umsatz$].Kundennummer group by KdID ", _
- objConnection, adOpenStatic, adLockOptimistic, adCmdText
- Dim i As Integer
- i = 0
- ' objRecordset.EOF And
- Debug.Print "----------------------------------------------------------------------"
- Do While Not objRecordset.EOF
- ' Debug.Print objRecordset.Fields.Item(0) ' & " ; " & objRecordset.Fields.Item(1)
- For Each fld In objRecordset.Fields
- Debug.Print fld.Value;
- Next
- Debug.Print
- 'komma unterstrich
- ' objRecordset.Fields.Item("Number")
- objRecordset.MoveNext
- i = i + 1
- Loop
- Debug.Print "--------------- " & Now() & " -------------------------"
- objRecordset.Close
- objConnection.Close
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement