值不显示在“访问表单”组合框中 [英] Values not showing in Access form combo box

查看:241
本文介绍了值不显示在“访问表单”组合框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access 2003中有一个我正在处理的应用程序。在它,我有一个employee表,它连接到另外两个表。两个连接的表是包含几个固定关键字的表。在我的主要雇员表中,我只是从其他表中的ID,而不是有整个字。

I have an application in Access 2003 that I am working on. In it, I have an employee table, which is connected to two other tables. The two connected tables are tables that hold a few fixed KeyWords. In my main employee table, I just have the ID from the other table, rather than having the whole word.

我想创建一个用于在这些表中输入数据的表单,所以我从三个表中进行查询,显示了employee表的所有常规字段的那两个ID,我展示了自己的话。

I wanted to make a form for entering data into these tables, so I made a query from the three tables that shows the all the regular fields of the employee table except instead of those two ID's, I showed the words themselves.

然后我创建了表单并将查询设置为RecordSource。有关键字的字段是我的表单上的组合框,它们的ControlSource是查询中的关键字字段(就像我前面提到的,值只能是列表中的一个关键字)。现在,我面临的问题是:当我想看到一个单一的记录,它显示在ComboBox中的正确的值,但是当下拉菜单,它不显示任何其他值。

I then made the form and set the query as the RecordSource. The fields that have keywords are Combo boxes on my form, and their ControlSource is the keyword field from the query (like I mentioned earlier, the value can only be one keyword out of a list). Now, the problem I face is this: When I want to see a single record, it shows the correct value in the ComboBox, but when dropdown the menu, it doesnt show any of the other values.

这是最好的方法是什么?

What is the best way to do this? Am I doing this in the wrong way?

谢谢

推荐答案

我的方法略有不同,设置组合框Row Sources包括id和文本字段(如果需要,可以隐藏ID列,将其宽度设置为零)。现在将ID字段添加到员工查询中;您不需要在此查询中将其他表连接到Employee表,这些字段是外键,组合框应自动显示文本。将记录源设置为此查询,现在将设置组合框控件源从记录源形式的适当ID值。

I'd approach this slightly differently, set the combo box Row Sources to include both the id and text fields (you can hide the ID column if required by setting it's width to zero). Now add the ID fields to the employee query; you shouldn't need to join the other tables to the Employee table in this query, these fields are foreign keys and the combo boxes should show the text for you automatically. Set the form Record Source to this query, now set the combo box Control Source to the appropriate ID value from the form Record Source.

如果让向导构建一个表单对于你根据Employee表,你会看到这种方法在行动。

If you let the wizard build a form for you based on the Employee table you will see this approach in action.

这篇关于值不显示在“访问表单”组合框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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