ADO-Abfrage
01.05.2005 00:56:30
Georg
Hallo Forum,
was ist hier nicht richtig? Könnte fast schwören, daß das letzte Woche noch funktioniert hat:
Option Explicit
Sub SQL_Tabelle()
Dim Recordset As ADODB.Recordset, ConnectionString As String
Dim SQL As String
ConnectionString = _
Provider=Microsoft.Jet.OLEDB.4.0; & _
Data Source= & ThisWorkbook.Path & "\Verkaeufe.xls;" & _
Extended Properties=Excel 8.0;
SQL = "SELECT * FROM 'Verkaeufe$'"
Set Recordset = New ADODB.Recordset
On Error GoTo Clean_it
Call Recordset.Open(SQL, ConnectionString, _
CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly, _
CommandTypeEnum.adCmdText)
'DATA ist der Codename von Tabelle1
Call DATA.[A1].CopyFromRecordset(Recordset)
Clean_it:
If Recordset.State = ObjectStateEnum.adStateOpen Then
Recordset.Close
End If
Set Recordset = Nothing
End Sub
Grüße Georg(HH)