对于...每个记录集问题 [英] For...Each Record Set Question

查看:53
本文介绍了对于...每个记录集问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与Access 2003一起运行的数据库。数据库用于跟踪订单并在这些订单上添加时间戳。我需要在数据库上放置一条弹出消息,在特定订单#s通过时提醒操作员。问题是有350种不同的订单#需要弹出消息。


我认为这样做的方法是使用记录集(包含350个订单)。使用for each语句,我想我可以根据当前订单检查每条记录。一旦找到订单,将弹出msg框并提醒操作员该订单需要更多关注。


我的问题是:这是实现此目的的最佳方法吗? />

感谢您的帮助。对不起,如果这是一个重复的问题(我搜索过,一无所获)。


Arli

解决方案

我不知道怎么做命令通过如果有人输入订单号,您可以使用更新前或更新后的事件,而不是每个只使用一个select语句,如果它不是eof,那么发送您的消息。

选择OrderNo从OrderNo = me的订单!txtBox


创建需要弹出警告的300多个订单号的表。我称之为tWarnExists并有一个名为OrderNo的字段。 OrderNo可以是主键。我打电话给条目文本框txtOrderNo。


然后代码很简单:

展开 | 选择 | 换行 | 行号


< blockquote>我会考虑创建一个链接两个表的查询(好主意btw,将标记的项目存储在表格中)。


一旦你有这个查询,你可以查看它轻松( DCount()),并使用它来获取当前列表,如果错误消息需要。根据您的要求,可能需要过滤查询结果。使用已定义的QueryDef对象很容易。


I have a database that is running with Access 2003. The Database is used to track orders and for putting time stamps on those orders. I need to put a pop up message on the database that alerts the operators when specific order #s come through. The problem is that there are 350 different order #s that require the pop up message.

I think the way to do this is with a recordset (containing the 350 orders). Using the for each statement, I think I can check each record against the current order. Upon finding the order, the msg box will pop up and alert the operator that the order requires more attention.

My question is this: is this the best way to accomplish this?

Thanks for your help. Sorry if this is a repeat question (I searched and found nothing).

Arli

解决方案

I am not sure how an order "Comes Through" If someone types in an order number you can use the before or after update event and instead of a for each just use a select statement and if it''s not eof then send your message.
Select OrderNo From Orders where OrderNo = me!txtBox


Create a table of those 300+ order numbers that require popup warnings. I called it tWarnExists and have 1 field named OrderNo. OrderNo can be the primary key. I called the entry textbox txtOrderNo.

Then the code is easy:

Expand|Select|Wrap|Line Numbers


I would consider creating a query which links the two tables (nice idea btw, to store the flagged items in a table).

Once you have this query available you can check it easily (DCount()) as well as use it to get the current list if that''s required for the error message. Depending on your requirement, the results from the query may need to be filtered. Easy enough with a defined QueryDef object available.


这篇关于对于...每个记录集问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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