热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

值未显示在Access窗体组合框中-ValuesnotshowinginAccessformcombobox

IhaveanapplicationinAccess2003thatIamworkingon.Init,Ihaveanemployeetable,whichis

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.

我正在使用Access 2003中的应用程序。在其中,我有一个employee表,它连接到另外两个表。两个连接的表是包含一些固定KeyWords的表。在我的主员工表中,我只是拥有来自另一个表的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.

我想创建一个表格,将数据输入这些表格,所以我从三个表格中查询了员工表格的所有常规字段,除了这两个ID之外,我自己展示了这些单词。

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.

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

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

做这个的最好方式是什么?我这样做是错误的吗?

Thank you

3 个解决方案

#1


3  

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.

我的处理方式略有不同,将组合框Row Sources设置为包含id和text字段(如果需要,可以通过将ID宽度设置为零来隐藏ID列)。现在将ID字段添加到员工查询中;您不需要将其他表连接到此查询中的Employee表,这些字段是外键,组合框应自动为您显示文本。将表单Record Source设置为此查询,现在将组合框Control Source设置为Record Source窗体中的相应ID值。

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

如果您让向导根据Employee表为您构建表单,您将看到此方法的实际应用。

#2


0  

You have set the query as the recordsource for the form. A form only shows (and ties to) ONE record at a time.

您已将查询设置为表单的记录源。表单一次只显示(并绑定)一条记录。

Since you want the combo box to show all the values, you should set the RecordSource of the ComboBox to your query.

由于您希望组合框显示所有值,因此应将ComboBox的RecordSource设置为您的查询。

#3


0  

ControlSource is the column name of the table where any user entry will be saved.

ControlSource是将保存任何用户条目的表的列名。

RowSource is where you type the name of the saved query or manual query typed directly into that field, which is used to provide a list of available drop down options for the combo box.

您可以在RowSource中键入直接键入该字段的已保存查询或手动查询的名称,该字段用于提供组合框的可用下拉选项列表。

RowSourceType should be set to Table/Query, which is based on aforementioned RowSource method.

RowSourceType应设置为Table / Query,它基于前面提到的RowSource方法。

Now to correct the problem of only displaying what you begin to type (i.e. "Allow AutoCorrect" in Property Sheet > Other) or already have saved for that record without other options appearing after clicking the drop down is the following:

现在,要解决仅显示您开始键入的内容(即“属性表”>“其他”中的“允许自动更正”)或已经为该记录保存的问题,而在单击下拉列表后没有显示其他选项的情况如下:

  1. In Design View, click the combobox in question.
  2. 在“设计视图”中,单击相关的组合框。

  3. Property Sheet > Format > Column Count = set the desired number of columns to display in drop down.
  4. 属性表>格式>列计数=设置要在下拉列表中显示的所需列数。

  5. Property Sheet > Format > Column Widths = set the desired width of column in the drop down.
  6. 属性表>格式>列宽度=在下拉列表中设置所需的列宽。

  7. Property Sheet > Format > List Width = set the desired width of the drop down itself.
  8. 属性表>格式>列表宽度=设置下拉本身的所需宽度。

  9. Property Sheet > Data > Bound Column = set to the column of query table (i.e. 1 for ID and 2 for list options, if you only have two entries)
  10. 属性表>数据>绑定列=设置为查询表的列(例如,1表示ID,2表示列表选项,如果您只有两个条目)

Note: If your desired drop down options are column two and not column one (makes things easier btw) then do the following change from above:

注意:如果您需要的下拉选项是第二列而不是第一列(使事情变得更简单),请从上面进行以下更改:

  1. Property Sheet > Format > Column Count = set the desired number of columns to two.
  2. 属性表>格式>列计数=将所需的列数设置为2。

  3. Property Sheet > Format > Column Widths = add two entries 0",1" which means the ID field is not visible (0") and the options field is one-inch.
  4. 属性表>格式>列宽度=添加两个条目0“,1”表示ID字段不可见(0“),选项字段为1英寸。

The easiest way to sort this out in the beginning is to view the column header names to know what you are looking at in the meantime by doing the following: Property Sheet > Format > Column Heads = set to yes. At least you will know what is showing and whether or not you are on the right track.

在开头对此进行排序的最简单方法是通过执行以下操作来查看列标题名称以了解您正在查看的内容:属性表>格式>列标题=设置为是。至少你会知道什么是显示以及你是否在正确的轨道上。


推荐阅读
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文介绍了UVALive6575题目Odd and Even Zeroes的解法,使用了数位dp和找规律的方法。阶乘的定义和性质被介绍,并给出了一些例子。其中,部分阶乘的尾零个数为奇数,部分为偶数。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • C++中的三角函数计算及其应用
    本文介绍了C++中的三角函数的计算方法和应用,包括计算余弦、正弦、正切值以及反三角函数求对应的弧度制角度的示例代码。代码中使用了C++的数学库和命名空间,通过赋值和输出语句实现了三角函数的计算和结果显示。通过学习本文,读者可以了解到C++中三角函数的基本用法和应用场景。 ... [详细]
  • 本文介绍了一个题目的解法,通过二分答案来解决问题,但困难在于如何进行检查。文章提供了一种逃逸方式,通过移动最慢的宿管来锁门时跑到更居中的位置,从而使所有合格的寝室都居中。文章还提到可以分开判断两边的情况,并使用前缀和的方式来求出在任意时刻能够到达宿管即将锁门的寝室的人数。最后,文章提到可以改成O(n)的直接枚举来解决问题。 ... [详细]
  • 3.223.28周学习总结中的贪心作业收获及困惑
    本文是对3.223.28周学习总结中的贪心作业进行总结,作者在解题过程中参考了他人的代码,但前提是要先理解题目并有解题思路。作者分享了自己在贪心作业中的收获,同时提到了一道让他困惑的题目,即input details部分引发的疑惑。 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • 本文讨论了一个数列求和问题,该数列按照一定规律生成。通过观察数列的规律,我们可以得出求解该问题的算法。具体算法为计算前n项i*f[i]的和,其中f[i]表示数列中有i个数字。根据参考的思路,我们可以将算法的时间复杂度控制在O(n),即计算到5e5即可满足1e9的要求。 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
author-avatar
额度v人_766
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有