使用附加查询从子表单中提取数据 [英] Pulling Data from Sub Form with an Append Query

查看:87
本文介绍了使用附加查询从子表单中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

所以,感谢nico的帮助,我终于能够完成我们的公司访问数据库。在过去一周左右的时间里,我一直在设计包含子表单和选项组的表单,这样只要按下选项组上的某个按钮,就会更改正确的子表单源对象属性以显示正确的表单。例如,如果他们点击添加新投资,子窗体的源对象现在更改为newInvestment。所有这一切都完美无瑕。最初我将每个表单设置为适当表格的绑定表单。我发现的是,如果用户只输入一个数据,它就会在该表中创建一条新记录。一件可怕的事!或者,至少它对我们来说是可怕的,因为它根本不是输入错误的原谅,也就是说,一个人通过输入他们不需要输入信息等信息的中途,我有一个提交按钮和一个取消按钮在主表格上。提交按钮重置每个对象在被压下之后纯粹出于审美目的。在我了解了绑定表单可能创建的问题后,我将它们全部解除绑定并尝试编写一个INSERT INTO SQL语句,该语句将在按下提交按钮时运行。虽然,从我在互联网上看到的内容和我看过的例子来看,一切都很好,但它永远不会运行。然后我尝试在访问中进行追加查询,看看是否可以从子表单中提取实际数据。当按下提交按钮时,我打算只在OpenQuery中添加追加查询。创建查询后,它永远不会看到在子表单中选择了任何内容。我用于标准的布局是:

Hello Everyone,
So, thanks to nico''s help I was finally able to ''finish'' our companies access database. For the past week or so though,I have been designing forms that contain a subform and an option group so that whenever a certain button on the option group is pressed the correct subform source object property is changed to display the correct form. For instance, if they click "add new investment" the subform''s source object is now changed to newInvestment. All of that is working flawlessly. Originally I had each form set up as a bound form to the appropriate table. What I was finding though was that if a user entered just one piece of data it created a new record in that table. A terrible thing! Or, at least it is terrible for us because it is not at all forgiving of input mistakes aka, a person relizes half-way through entering information they don''t need that info entered etc. I have a submit button and a cancel button on the main form. The submit button ''resets'' each object after it is depressed that purely for asthetic purposes. After I learned of the problems a bound form could create I made them all unbound and tried to write an INSERT INTO SQL statement that was would run when the submit button was pressed. Although, from what I have read on the internet and the examples I have seen, everything was layed out fine, but it would never run. I then tried to make an append query in access and see if I could pull the actual data from the subform. I planned to just OpenQuery the append query when the submit button was pushed. Upon creating the query, it could never "see" that anything was choosen in the subform. The layout I used for the criteria was:

展开 | 选择 | Wrap | 行号

推荐答案

您可以保留绑定的表单但是当他们意识到他们不需要那些信息时,他们可以使用撤消按钮。代码也很简单,在按钮的On Click事件中,只需要
You can keep the bound forms but have an Undo button for those times when they realize they don''t need that info. The code is simple too, in the On Click event of the button, just have
展开 | 选择 | Wrap | 行号


这看起来很酷,我试过出来。我注意到它并没有撤消子表单。


我也试过以下代码:

This looks cool and I tried it out. I''ve noticed that it doesn''t undo the subform, though.

I tried the following code also:

展开 | 选择 | Wrap | 行号



这看起来很酷,我试了一下。我注意到它并没有撤消子表单。


我也试过以下代码:

This looks cool and I tried it out. I''ve noticed that it doesn''t undo the subform, though.

I tried the following code also:

展开 | 选择 | Wrap | 行号


这篇关于使用附加查询从子表单中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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