Ich entwickelte eine App, die Daten aus VFP-freien Tabellen und Datenbanken mit VBA bei Excel 2013 Pro 32 Bits lesen. Der Computer, mit dem diese App entwickelt wurde, wurde formatiert. Danach installierte ich Office 2016 Pro Plus 64 Bit auf demselben Computer. Visual FoxPro 9.0 SP2 und OLE DB Provider für Visual FoxPro 9.0 SP 2 wurden ebenfalls installiert.Excel VBA App lädt keine Daten
Wenn ich die App erneut ausführen, wird der Laufzeitfehler 3706 ausgegeben. Vor der Formatierung können mit dieser App Datenbanken und freie Tabellen problemlos geöffnet werden.
Was habe ich getan? Installieren und deinstallieren Sie VFP (und Service Pack 2) und OLE DB Provider.
Warum das passiert? Fehle ich während der VFP-Installation oder während der Office-Installation eine Datei? Fehle ich andere Software? Ich verwende Windows 7 64 Bit Professional SP1.
Vielen Dank im Voraus für Ihre Antwort.
UPDATE: Dieser Code gibt den Fehler
'Example for free table
Sub OpenFreeTableForReading()
Dim cnConnection As ADODB.Connection
Dim rstRecordSet As ADODB.Recordset
Dim strConnection As String, strQuery As String
Dim strErrMessage As String
Dim arrData As Variant
Dim lngX As Long
On Error GoTo ErrSub
'Setting connection object and query string command
strConnection = "Provider=VFPOLEDB.1;DataSource=C:\Path\to\TableToOpen.dbf;"
strQuery = "SELECT * FROM TableToOpen"
Set cnConnection = New ADODB.Connection
cnConnection.ConnectionString = strConnection
'This line issues runtime error 3706
cnConnection.Open
'Retrieved records are kept on an array
Set rstRecordSet = New ADODB.Recordset
With rstRecordSet
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.Open strQuery, cnConnection, adOpenStatic
If Not (rstRecordSet.EOF) Then
'Disconnect the recordset
.ActiveConnection = Nothing
'Get the field count
lngX = .Fields.Count
arrData = .GetRows()
Else
'Recordset is empty; create dummy array record
ReDim arrData(0, 0)
End If
End With
'Printing data - ommited
CloseAll:
cnConnection.Close
Exit Sub
ErrSub:
strErrMessage = CStr(Err.Number) & " " & Trim(Err.Description)
MsgBox strErrMessage
Resume CloseAll
End Sub
Hallo. Bitte poste deinen Code, es ist unmöglich zu sagen, ohne das anzusehen. –