使用ComboBox显示从相关表显示值的数据输入
我是MS Access的新手,并且已经开始了一个小项目来了解其工作原理。这是一个小型数据库,可存储安全数据表和其他文档,以获取许多化学物质。
关系的概述: db-relationshiphip
我已经制作了一个数据输入表格,使用户能够输入新记录(新记录(新文件) +文件信息):
表单正常,但是目前用户必须手动输入该表单语言表“ sprachen_tabelle”的主要键值(sprache_id)作为数值,这不是很好。我想将其更改为用户从ComboBox中选择“ sprachen_tabelle”中存储在'sprachen_tabelle'中的语言shorthandle(en,de,fr等)的组合,然后将相应的sprache_id应用于数据输入。我可能会从用户隐藏ID,然后以某种方式隐藏ID。
现在,我尝试了自己添加一个ComboBox,但我遇到了一个问题,即“ sprache_id”并未根据“ bezeichnung''中选择的值进行更新。一种方法可以正常工作,意思是1:Enter Sprache_id 2:自动应用与Sprache_ID对应的bezeichnung。但是,另一种方式不是。从ComboBox选择语言肖德尔的值时,而不是选择与“ sprachen_tabelle”中该值相对应的记录,并与表'sdb_tabelle'相匹配,而是在'sprachen_tabelle'sprachen_tabelle'中表现出'sdb_tabelle'反而。
Combobox详细信息:
控制(DE中的Steuerelelementinhalt,不确定英语,数据中的第一行):
bezeichnung
RecordsOuce:
SELECT [sprachen_tabelle].[bezeichnung] FROM sprachen_tabelle;
我还尝试将RecordsOrce设置为:
SELECT [sprachen_tabelle].[sprache_id], [sprachen_tabelle].[bezeichnung] FROM sprachen_tabelle;
和控制功能:
sprache_id
但这也无济于事。
也许这是一个问题,因为该表单设置为数据输入,也许我应该在其中包含ComboBox的数据输入中添加一个子形式,但是我不确定这是否会起作用。这也可能是如何设置数据输入表格。它目前是包含stoff_id的表单,然后在其上具有一个子形式,用于数据输入,该数据输入链接到主要形式上的“ stoff_id”:
我已经陷入困境了2天,如果有人可以提供帮助,我将非常感谢它。 另外,我知道我的表格和字段的名称现在是一团糟,我可能应该将文件链接到数据库,而不是使用访问中的附件功能(尽管想尝试一下)。
I'm new to ms access and have started a little project to learn how it works. It's a small database that stores safety datasheets and other documents for a number of chemical substances.
An overview of the relationships:
DB-Relationship
I have made a data entry form that enables users to enter new records (new files + file info):
The form works fine, but currently the user has to manually enter the primary key value (sprache_id) for the language table 'sprachen_tabelle' as a numerical value, which is not great. I would like to change this to a combobox where the user selects the language shorthandle (EN,DE,FR etc.) that is stored in 'sprachen_tabelle' under 'bezeichnung' from the combobox, and the corresponding sprache_id is then automatically applied to the data entry. I would probably hide the id from the user then somehow.
Now, I have tried adding a combobox myself but I ran into the problem that 'sprache_id' is not being updated based on the value selected in the combobox for 'bezeichnung'. One way around works fine, meaning 1: enter sprache_id 2: bezeichnung corresponding to sprache_id is applied automatically. The other way however, does not. When selecting a value with the language shorthandle from the combobox, instead of selecting the record that corresponds to that value in 'sprachen_tabelle' and matching 'sprache_id' to the table 'sdb_tabelle', it seemingly commits to an entirely new record in 'sprachen_tabelle' instead.
Combobox details:
control (Steuerelementinhalt in DE, not sure in english, first row in data):
bezeichnung
Recordsouce:
SELECT [sprachen_tabelle].[bezeichnung] FROM sprachen_tabelle;
I have also tried setting the recordsource to:
SELECT [sprachen_tabelle].[sprache_id], [sprachen_tabelle].[bezeichnung] FROM sprachen_tabelle;
and the control to:
sprache_id
but that didn't help either.
Maybe this is a problem because the form is set to data entry, and perhaps i should add a subform to it with data entry off that contains the combobox, but I'm not sure if that would even work. It might also be how the data entry form is set up. It is currently a form that contains the stoff_id which then has a subform on it for data entry that is linked to 'stoff_id' on the main form:
I've been stuck on this for 2 days now and would really appreciate it if someone could help.
Also, I am aware the names for my forms and fields are a mess right now and that I should probably just link the files to the database instead of using the attachment feature in access (wanted to try it out though).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论