I am creating a pass through union query using an ODBC data source and trying to open the recordset with form!Formname.Recordset = qdf.opernRecordset. The query executes properly and returns the expected data, but when I go to execute the above code I get the error:

Error 3251 Operation is not supported for this type of object.

I know that help,concerning this error, states:

Some operations are also not supported, depending on if you are accessing a Microsoft Jet or an ODBC data source.

What is this error caused by and what is a potential workaround?

有帮助吗?

解决方案

In VBA, use the equal sign to assign a value to a simple variable:

MyText = "foo"

But use the Set keyword when assigning to an object variable. In your case, the form's Recordset is a property rather than a variable, but that property is an object, so you still need Set:

Set form!Formname.Recordset = qdf.OpenRecordset
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top