如果满足日期条件,则循环记录并显示弹出消息 [英] Loop though records and display pop up message if a date Criteria is met

查看:81
本文介绍了如果满足日期条件,则循环记录并显示弹出消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为InvestmentF的表格,基于表格InvestmentF,包含以下字段


投资者姓名

InvestorID

InvestmentDate

MaturityDate


我想要的是在加载时,Access应查看记录集并检查在MaturityDate上会成熟并显示连续的投资所有成熟投资的流行消息


我想循环会有所帮助,但无法弄清楚如何去做。

这是我有的代码所以但它只是打开表格而什么都不做!


如果还有其他办法,我会很感激。

I have a form called InvestmentF based on a table InvestmentF with the following fields

Investor Name
InvestorID
InvestmentDate
MaturityDate

What I want to is that on load, Access should look through the recordsets and check for Investments which would mature on the MaturityDate and display a continuous pop Message for all matured investments

I guess Do loop would help but cannot really figure out how to go about it.
This is the code I have so far but it just open the form and does nothing!

I would appreciate if there is another way to do this.

展开 < span class =codeDivider> | 选择 | Wrap | 行号

推荐答案

在我们沿着这条路走下去之前...

你建议做什么不被认为是对于超过一两条这样的消息,用户最友好。


作为最终用户,如果程序员在我的脸上塞了十几个弹出提示,我会非常高兴通过大约第四个这样的消息。当时出现的不仅仅是突然出现的话,我会带领音叉和旅行团。


我强烈建议您重新考虑表单的设计:


有一个带有组合框的表单,允许您选择成熟,未成熟和全部。表格的过滤器和控件默认设置可以设置为显示负载上的成熟记录


(这些洞察力文章应该提供一些指导:
- Microsoft Access / VBA Insights Sitemap
。级联表单过滤
。具有清除选项的多个组合框过滤器
。在表单上过滤示例。



OR


- 也许使用条件格式
更改外观o使用条件格式(ACC2007 / 2010)使用比较值记录的成熟度进行控制。





也许是一个包含两个子表单的未绑定父表单。一个基于查询的子表单,该查询提取尚未成熟的记录,而第二个子表单基于已成熟记录的查询。


如果你真的坚持弹出 - ups,那么我要做的就是使用存储查询或在vba中打开记录集来拉取这些记录。检查记录集中是否有记录。移至第一条记录。然后使用do..while..not EOF循环并使用您想要的记录中的信息弹出消息...当Mob在您的办公室外时,不要来找我!
Before we go down this route...
What you suggest doing is not considered to be the most user friendly for more than one or two such messages.

As an end user, if the programmer stuffed a dozen pop-up prompts in my face, I''d be highly irrate by about the fourth such message. I''d be leading the pitch-fork and tourch mob by the time anything more than that popped up.

I would highly recommend that you reconsider the design of your form:

Have a form that has a combobox that allows you to select matured, unmatured, and all. The form''s filter and control default could be set to show the matured records on load

(These insight articles should provide some guidence here:
- Microsoft Access / VBA Insights Sitemap
.Cascaded Form Filtering
.Multiple Combobox Filter with Clear Option
.Example Filtering on a Form.


OR

- perhaps to use conditional formating
Change the appearance of a control by using conditional formatting (ACC2007/2010) using the maturity of the record for the comparision values.

OR

Perhaps an unbound parent form that has two subforms. One subform based on a query that pulls the records that have not yet matured and the second subform based on a query where the records that have matured.

IF you truely insist on the pop-ups, then what I would do is either use stored query or open a recordset in the vba that pulls these records. Check that the record set has records in it. Move to the first record. Then use a do..while..not EOF loop and pop-up the message with the information from the record that you want... just don''t come to me when the Mob is outside your office!


好的我明白你的意思了。但这是我们为数据库开发的请求。他们想要Pop ups。你能详细说明如何使用do while循环来生成弹出窗口吗?
Ok I got your point. But it was a request made by those am developing the database for. They want Pop ups. Can you please elaborate on how to use the do while loop for me to generate the pop up?


如果你坚持这种方法,为什么不显示一个显示所有投资的弹出对话框,通过他们的ID,将在当前日期成熟?
If you insist on this approach, why not display a single Pop Up Dialog displaying all Invesments, via their IDs, that will mature on the Current Date?
展开 | 选择 | Wrap | 行号


这篇关于如果满足日期条件,则循环记录并显示弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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