[有几个第三方应用程序检索某些信息(全部用VBA编写)。例如,我创建了一个Excel VBA宏,该宏可从.dbfs中提取债务和应用的贷项,并生成一个批处理文件以上传到商家。
我已安装VFPOLEDBSetup驱动程序来执行此操作。它已经运行了一年,没有错误。
MainSystems进行了系统更新,现在第三方应用程序返回错误。
Excel返回
“运行时错误'-2147467259(80004005):DIRECTORY \ FILE.dbf不是表。”在线
rs.Open sql, con
和Visual Fox应用程序仅返回
“不是桌子。”这些应用程序在更新之前都可以正常工作,只有我注意到可能有所不同的地方是.dbfs文件夹中,在更新当天创建了.cdx,我想知道这是否可能导致错误。如果是这样,是否有解决此问题的解决方案?
我对数据库不是很了解。
'Changing directories
DBFFolder = "G:\DIRECTORY\"
FileName = "File.DBF"
On Error Resume Next
'Create the ADODB connection object.
Set con = CreateObject("ADODB.connection")
'Check if the object was created.
If Err.Number <> 0 Then
MsgBox "Connection was not created!", vbCritical, "Connection error"
Exit Sub
End If
On Error GoTo 0
'Open the connection.
con.Open "Provider=vfpoledb;" & "Data Source=" & DBFFolder & FileName & ";Collating Sequence=machine"
'Create the SQL statement to read the file.
'Note that the filename is used instead of the table name.
sql = "SELECT * FROM " & Left(FileName, (InStrRev(FileName, ".", -1, vbTextCompare) - 1))
On Error Resume Next
Set rs = CreateObject("ADODB.recordset")
'Check if the object was created.
If Err.Number <> 0 Then
MsgBox "Connection was not created!", vbCritical, "Connection error"
Exit Sub
End If
On Error GoTo 0
'Open the recordset.
rs.Open sql, con
预期结果:访问DBF表并复制信息。
UPDATE
找到了错误的原因。 MainSystems在表中增加了列,使其超过256列。 (262)使Microsoft驱动程序无法将其识别为表。有解决方法吗? 一个软件管理系统,我们称其为“ MainSystems”,可以接受订单,创建发票等。MainSystems使用多个.DBF文件作为数据库。有多个第三方应用程序,...