从表单更改Access中的表中的任何一个值 [英] Change any one value in a table in Access from a form

查看:68
本文介绍了从表单更改Access中的表中的任何一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Access / VBA(2003版)的相对初学者,我正在寻找一个似乎是一个相当简单的问题的解决方案...


当用户输入时表单对象中的文本字符串,我希望该字符串成为表中的新值,该表已包含各种字段和记录。我不想要创建新的RECORD,但是想要将这个新值(由用户输入)放在我在表格中选择的任何特定框中。


例如,如果我的表中的字段编号2在下面的记录的列中列出了三个值,而字段编号3在其列中有10个值,我可能想要添加用户输入的文本字符串作为第2列中的第四个值,而不是将整个新记录附加到表的底部。


对此有所帮助或指导... ...
Anthony

解决方案

< blockquote>在表单上有一个文本框,用户可以在其中输入数据。您是否还在表单上有一个字段,该字段对应于您希望此数据转到表格中的字段?


您的表单是否绑定到此表。即表单的记录是否基于此表?


如果您正在谈论在表单中动态地向表定义中添加字段,那么也许您不会不知道这有多容易(可能)。


假设我理解正确,那么你甚至不去Access。它不值得你的痛苦(假设它甚至可能)。



如果你在动态地谈论在表单中动态地向表定义添加字段,然后也许你不会意识到这是多么容易(可能)。


假设我理解正确,然后甚至不去Access。它不值得你的痛苦(假设它甚至可能)。



可以使用vba添加一个字段,但由于显而易见的原因,它充满了危险。如果向表中添加字段,那么该字段在何处使用和/或引用。它在整个数据库中有什么影响?除非你已经探索了解决问题的所有其他方法,否则这样的规则是不要做的。


如果像NeoPa说这就是你想要的做为什么?可能有更好的方法。


As a relative beginner with Access/VBA (2003 version), I am looking for a solution to what seems to be a fairly simple problem...

When a user inputs a text string in a form object, I would like that string to become a new value in a table which already consists of a variety of fields and records. I don''t want a new RECORD to be created, but would like to place this new value (as entered by the user) in any particular box I choose in the table.

For example, if field number 2 in my table has three values listed in its column in the records below, and field number 3 has 10 values in its column, I might want to add the user-entered text string as the fourth value in column 2, without appending an entire new record to the bottom of the table.

Help or guidance on this is appreciated...

Anthony

解决方案

On your form you have a textbox in which the user enters data. Do you also have a field on the form that corresponds to the field on the table that you want this data to go to?

Is your form bound to this table. i.e. Is the Record Souce of your form based on this table?


If you''re talking about dynamically adding fields to a table definition on the fly within a form, then perhaps you don''t appreciate how easy (possible) this isn''t.

Assuming I understand you correctly, then don''t even go there in Access. It won''t be worth your pain (assuming it''s even possible).


If you''re talking about dynamically adding fields to a table definition on the fly within a form, then perhaps you don''t appreciate how easy (possible) this isn''t.

Assuming I understand you correctly, then don''t even go there in Access. It won''t be worth your pain (assuming it''s even possible).

It''s possible to add a field using vba but for obvious reasons its fraught with danger. If you add a field to a table then where is that field used and/or referenced. What implications does it have throughout the database? The rule on something like this is don''t do it unless you''ve explored all other ways of solving your problem.

If like NeoPa says this is what you are trying to do the WHY? There may be a better way.


这篇关于从表单更改Access中的表中的任何一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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