添加不在列表中的项目 [英] Add Items Not In List

查看:63
本文介绍了添加不在列表中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与如何在现有表单中显示新添加的记录?

我的样子对我来说似乎是个烂摊子,虽然我想要实现的目标看起来相当简单。这就是我希望这样做的方式:


1.用户在Jump To中输入一个数字。领域。如果数字已经存在于数据库中,那么它应该转到该记录,现在它就是这样。


2.但是,如果数字不在数据库中,我想要一个是/否窗口弹出显示输入的数字,问题是添加新图表编号?。


3.点击是按钮将向数据库添加记录,在ChartNum字段中使用新数字,关闭弹出窗口,并使父表单转到新记录。


4.单击否]将关闭是/否窗口,并完全保留父窗体,并使用跳转到窗口。字段空白。


目前,用户必须重新输入数字,如果他们想要添加它,如果他们不想添加任何内容,请关闭弹出窗口(当前的)生成另一个不在列表中的项目。错误框。并且用户必须自己转到新记录,但它也不总是可以跳转到。


我似乎有很多小的代码片段我不能很好地一起玩,而且我不太了解所涉及的不同事件,知道在哪里做这一切的最佳位置。不知何故,似乎我不必为了添加新记录而有一个单独的基于表单的数据库,但我不知道有任何其他方法可以做到这一点。以下是不同的代码块,按照它们发生的顺序:


表单上的未绑定字段跳转到 Patient_IUR_Overview 有以下两个例程:

Jump_To_AfterUpdate 跳转到与用户输入匹配的记录,似乎工作正常:

This question is related to the database found in How to make a newly-added record show up in an existing form?.

What I have seems like a hot mess to me, while the thing I''m trying to achieve seems fairly simple. Here''s how I would like this to behave:

1. The user puts a number in the "Jump To" field. If the number is already in the database, it should just go to that record, and it now does that.

2. If, however, the number is NOT in the database, I want a Yes/No window to pop up displaying the number that was entered, and the question "Add the new chart number?".

3. Clicking "Yes" would add a record to the database, with the new number in the ChartNum field, close the popup, and cause the parent form to go to the new record.

4. Clicking "No" would close the "Yes/No" window, and leave the parent form exactly as it was, with the "Jump To" field blank.

Currently, the user has to re-enter the number if they do want to add it, and if they don''t want to add anything, closing the popup window (the current one) generates another "Item not in list" error box. And the user has to go to the new record herself, but it is also not always available to "jump to".

I just seem to have a lot of little scraps of code that don''t play well together, and I don''t know enough about the different events involved to know where is the best place to do all this. Somehow, it seems that I shouldn''t have to have a separate form-based-on-the-database just to add a new record, but I don''t know any other way to do that. Here are the different chunks of code, in the order they are happening:

The unbound field Jump To on the form Patient_IUR_Overview has the following 2 routines:

Jump_To_AfterUpdate jumps to the record that matches the user''s input, and seems to work correctly:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

你建议的方法是我喜欢的方法,它当然可以实现(虽然我不会说它''像你似乎一样直截了当hink)。


随着代码工作(我需要OCX文件)我可以更好地测试它,很可能你的代码/设计不是太远了。如果它不涉及太多工作,我可能会帮助你解决这种情况。当我有文件可用时,我会再次详细介绍。
The approach you suggest is one I like, and it can certainly be implemented (although I wouldn''t say it''s as straightforward as you seem to think).

With the code working (I need the OCX file for that) I may be able to test it better and it may well be that your code/design isn''t too far off. If it doesn''t involve too much work I may well help you to resolution of this situation. I''ll look again in more detail when I have the file available.


关于在线上捕获用户的答案:
In regards to capturing the user''s answer on lines:
展开 | 选择 | Wrap | 行号


不是劫持笑脸:-)那就是你改变主题的时候。


跳跃 - 也许,但是在这么好的答案之后我不能抱怨(即使我有那个权利 - 我不是)。我仍然会继续关注这个问题,但我认为你已经打破了它的背后。我只是想确保苏欣赏她所建议的方法是非常明智和可行的,如果它确实需要在Access中实现一些编码。
Not a Hijack Smiley :-) That''s when you change the subject of the thread.

Jumping-in maybe, but I couldn''t complain about that after such a good answer (even if I had that right - which I don''t). I''ll still keep my eye on this thread but I think you''ve already broken the back of it. I just wanted to make sure Sue appreciated that the approach she suggested is very sensible and workable, if it does take a little bit of coding to implement within Access.


这篇关于添加不在列表中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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