Excel 2013 Pro 32ビットでVBAを使用して、VFPフリーテーブルとデータベースからデータを読み取るアプリケーションを開発しました。そのアプリケーションを開発するために使用されたコンピュータがフォーマットされました。その後、Office 2016 Pro Plus 64ビットを同じマシンにインストールしました。 Visual FoxPro 9.0 SP2およびVisual FoxPro 9.0 SP 2のOLE DBプロバイダーもインストールされました。Excel VBAアプリケーションでデータが読み込まれない
私は再びアプリケーションを実行すると、ランタイムエラー3706が発行されます。フォーマットする前に、そのアプリケーションはデータベースとフリーテーブルを問題なく開いています。
私は何をしましたか? VFP(およびService Pack 2)とOLE DBプロバイダをインストールしてアンインストールします。
なぜですか。 VFPのインストール中またはOfficeのセットアップ中にファイルが見つからないのですか?他のソフトウェアがありませんか?私はWindows 7 64ビットProfessional SP1を使用しています。
ご回答いただきありがとうございます。
UPDATE:このコードは、エラー
'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
こんにちは。あなたのコードを投稿してください。それを見ずに言うことは不可能です。 –