Recordset“对象变量或未设置块变量” [英] Recordset "Object variable or With Block variable not set"

查看:182
本文介绍了Recordset“对象变量或未设置块变量”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开始说我是新手代码编写者。我试图通过电子邮件根据每个供应商发送报告。下面的代码就是我正在使用的代码。我需要在Form上创建记录集,生成的报告基于该表单上的供应商编号,以便只创建一个报告。


这是Access 2000,Windows 2000

I want to start out saying I am a novice code writer. I am trying to send a report via email based on each supplier. The code below is what I am using. I need to base recordset on Form, report generated is based on the supplier number on that form so as to only create a single report.

This is Access 2000, with Windows 2000

展开 | 选择 | Wrap | 行号

推荐答案

嗨尼克。我认为你的问题在第12行,我想应该引用RecordsetClone属性来复制表单中的基础记录集:

设置rst = Me.Recordsetclone


由于对象变量rst中没有有效的当前记录集,因此出现了对象错误。


-Stewart
Hi Nick. I think your problem is at line 12, which I guess should be referring to the RecordsetClone property to copy the underlying recordset from your form:

Set rst = Me.Recordsetclone

The object error is arising because there is no valid current recordset in object variable rst.

-Stewart


谢谢。


我做了这个更改,现在它抛出错误声明你输入并且表达式对RecordsetClone属性的引用无效


**注意:我使用的表单中有一个子表单。我不知道这是否是问题的一部分。


非常感谢任何帮助。


Nick
Thank you.

I made that change and now it is throwing error stating "You entered and expression that has an invalid reference to the RecordsetClone Property"

**Note: The form I am using has a subform located in it. I dont know if this is part of the problem.

Any help is greatly appreciated.

Nick


请原谅我,如果我错了,我在你的代码中没有看到你引用 rst 对象来选择字段值。


例如:

strSendTo = [更新PO信息EMAIL的Report_Request] .Supplier_Email


必须写为


strSendTo = rst! [Report_Request for PO PO Info EMAIL] .Supplier_Email




> 使用rst

strSendTo = [更新PO信息EMAIL的Report_Request] .Supplier_Email




结束


不是吗。其他陈述也需要改变。
Pardon me if I am wrong, I don''t see anywhere in your code you are referencing the rst object for picking the field values.

For example :

strSendTo = [Report_Request for Updated PO Info EMAIL].Supplier_Email

must be written as

strSendTo = rst![Report_Request for Updated PO Info EMAIL].Supplier_Email

or

With rst
strSendTo = .[Report_Request for Updated PO Info EMAIL].Supplier_Email
.
.
End with

isn''t it. Need change in other statements also.


这篇关于Recordset“对象变量或未设置块变量”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆