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 (및 서비스 팩 2) 및 OLE DB 공급자를 설치하고 제거하십시오.
왜 그런가? VFP를 설치하는 동안 또는 Office 설치 중에 파일이 누락 되었습니까? 다른 소프트웨어가 누락 되었습니까? Windows 7 64 Bit Professional SP1을 사용하고 있습니다.
미리 답변 해 주셔서 감사합니다.
업데이트 :이 코드는이 어둠 속에서 샷을
'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
안녕하세요. 귀하의 코드를 게시하십시오, 그것을 보지 않고 말할 수는 없습니다. –