简体   繁体   English

Access 2003 - 通过查询,查询定义和Form.Recordset(哦,我的)

[英]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 . 我正在使用ODBC数据源创建传递联合查询并尝试使用form!Formname.Recordset = qdf.opernRecordset打开记录集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: 在VBA中,使用等号为一个简单变量赋值:

MyText = "foo"

But use the Set keyword when assigning to an object variable. 但是在分配给对象变量时使用Set关键字。 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 : 在你的情况下,表单的Recordset是属性而不是变量,但该属性是一个对象,所以你仍然需要Set

Set form!Formname.Recordset = qdf.OpenRecordset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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