简体   繁体   中英

Access 2003 - Pass Through Queries, Query Definitions and Form.Recordset (Oh My)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM