Error VB6 "Invalid use of property", where the code seems to be fine

I have a very strange problem. Firstly, the code.

Private Function ProcessRecord(ByVal rsDocs As ADODB.Recordset) As Variant

   Dim rsTemp As ADODB.Recordset
   rsTemp = rsDocs
   rsDocs = RemoveDuplicateDocs(rsTemp)

Exit Function

The error occurs in the second line of the function, where rsTemp is set to rsDocs. He says: "Compilation error: incorrect use of the property." I looked for information about this error elsewhere, and all reports are cases when people either forgot the equal sign or incorrectly added the "Install" command to the beginning of the line of code. This error does not make any sense to me, because it was compiled before, and the changes that I made to this project are not even in the class that throws the error. The code here is identical to how it was before. Has anyone ever seen an error like this pop up for something that apparently isn't a good reason? Thank!

+3
source share
1 answer

You need to use

set rsTemp = rsDocs

since rsTemp is an object.

+7

Source: https://habr.com/ru/post/1771370/


All Articles