I have had a Microsoft Access application working for many years. However today the following code has stopped working.
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)
It reports the following error:
Error 13 Type mismatch
Could this be a result of an Office Update?
Has anybody else come across this problem?
My Access Version is Microsoft® Access® for Microsoft 365 MSO (Version 2206 Build 16.0.15330.20216) 64-bit