我有一个微软Access应用程序工作了很多年。然而,今天,以下代码已停止工作。
Dim Recordset2 As DAO.Recordset2
Dim fieldAttachment As DAO.Field2
stringSQLText = "SELECT [" & stringTable & "].ID" & vbCrLf
stringSQLText = stringSQLText & " , [" & stringTable & "].[" & stringFieldName & "]" & vbCrLf
stringSQLText = stringSQLText & " FROM [" & stringTable & "]" & vbCrLf
stringSQLText = stringSQLText & " WHERE ((([" & stringTable & "].ID)=" & longID & "));"
Set Recordset2 = CurrentDatabase.OpenRecordset(stringSQLText, dbOpenSnapshot)
'Error occurs here
Set fieldAttachment = Recordset2(stringFieldName)它报告了以下错误:
错误13类型失配
这是否是的结果?
还有人遇到过这个问题吗?
我的Access版本是Microsoft Access for Microsoft 365 MSO (版本2206 Build 16.0.15330.20216) 64位
发布于 2022-07-13 17:48:32
将代码更改为使用Field3而不是Field2,现在可以工作了。
https://stackoverflow.com/questions/72970155
复制相似问题