如何将值设置为表单下的表中的字段 [英] How to set a value into a field in a table underlying a form

查看:89
本文介绍了如何将值设置为表单下的表中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个看起来很简单,但我整天都在苦苦挣扎而且无法得到它......


我有一个表格,其中用户可以通过使用带有向导的组合框来选择基础表中的记录,并根据值...在表单上查找记录。它生成SearchForRecord宏并找到所需的记录OK。到目前为止一直很好。


现在我想要做的就是将该记录中的是/否字段的值设置为是。我有一个命令按钮(但已尝试切换按钮和文本框控件),应设置该字段,然后关闭表单并打开报表。关闭表单和打开报表工作正常,但如何设置字段值?


Peter

解决方案

假设有基础表中的是/否字段,将其绑定到复选框(勾选)。


然后运行您的代码OnClick将关闭表格&打开你的报告,或者更有可能在AfterUpdate上检查结果是否为真。


Phil


这给我的结果与切换按钮 - 更新或取消更新,不添加AddNew或编辑。我尝试过使用Walks.Edit BeforeUpdate和Walks.Update AfterUpdate,但我真的不知道如何或将它们放在哪里使其工作。


出于审美原因,我更愿意使用看起来像是与系列中其他弹出窗体相匹配的按钮 - 选择按下Go" ;.

[IMG] C:\ Users \ PeterPe \\Picture1.png [/ IMG]

This one looks simple enough, but I''ve been struggling with it all day and just can''t get it ...

I have a form in which the user can select a record from an underlying table, by using combo box with the wizard''s "Find a record on my form based on the value ...". It generates the SearchForRecord macro and locates the required record OK. So far so good.

Now all I want to do is set the value of a Yes/No field in that record to Yes. I have a command button (but have tried toggle button and text box controls) which should set the field then close the form and open a report. The close form and open report work OK, but how to set the field value?

Peter

解决方案

Assuming there is a Yes/No field in the underlying table, bind it to a check box (tick).

Then run your code either OnClick which will close the form & open your report, or more likely on the AfterUpdate having checked that the result is True.

Phil


This gives me the same result as the toggle button - "Update or CancelUpdate without AddNew or Edit". I tried putting Walks.Edit BeforeUpdate and Walks.Update AfterUpdate, but I don''t really know how or where to put them to make it work.


For aesthetic reasons I would prefer to use something that looks like a button that matches the other pop-up forms in the series - Make your selection the press Go".
[IMG]C:\Users\Peter\Pictures\Picture1.png[/IMG]


这篇关于如何将值设置为表单下的表中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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