组合框不工作 [英] Combo Box not working

查看:47
本文介绍了组合框不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:


我无法获得一个组合框来显示搜索表单中的列表。我的目标是选择一个艺术家的名字,并通过qry在子表格中列出他/她的CD。但我不能这样做。当我尝试输入艺术家的名字时,我收到一条错误消息,告诉我列表中不存在该名称。我通过键入CD标题成功获取数据,但无法获得艺术家搜索工作的组合框。有人可以帮忙吗?


详情如下:


表1:tblArtists

ArtistID - Auto(PK)

ArtistName-文字


表2:tblCDDetails

RecordID - 自动(PK)

RecordingTitle - 文字

ArtistID - FK


表3:tblzNull

ItemID - 自动(PK)

ItemName - 文字


查询1:qryCD

RecordingID

RecordingTitle

ArtistID

ArtistName


主表格1:frmFIND

文本框1 = txtCDTitle(不作承诺)

组合框1 = cboArtist(未绑定)但在源代码下有此代码

Hello all:

I could not get a combo box to display a list in a Search Form. My object is to select an artist''s name and have his/her CDs listed on the subform through a qry. But I couldn''t do it. When I tried to type an artist''s name, I get an error message telling me the name does not exist in the list. I was successful in getting data by typing a CD title but couldn''t get the Combo box for the Artist''s search to work. Can someone please help?

Details follow:

Table 1: tblArtists
ArtistID - Auto (PK)
ArtistName- Text

Table2: tblCDDetails
RecordID - Auto (PK)
RecordingTitle - Text
ArtistID - FK

Table 3: tblzNull
ItemID - Auto (PK)
ItemName - Text

Query 1: qryCD
RecordingID
RecordingTitle
ArtistID
ArtistName


Main Form 1: frmFIND
Text box 1 = txtCDTitle (Unbound)
Combo Box 1 = cboArtist (Unbound) but has this code under Row Source

展开 | 选择 | Wrap | 行号

推荐答案

有一个查看表单上的示例过滤,看看之后是否可以这样做。


如果没有,请回来告诉我们。我们希望您熟悉该主题中的内容。


欢迎来到字节
Have a look at Example Filtering on a Form and see if you can do it after that.

If not, please come back and let us know in here. We will expect you to be familiar with what''s in that thread though.

Welcome to Bytes!


我阅读了你发送的CH 1 -7的说明以及RABBIT的文章。谢谢。


我还需要帮助。


主表单上的我的组合框叫做cboArtist


列数= 2

绑定列= 1


控制源=未绑定

行源类型=表/查询

行来源:
I read the instructions you sent CH 1 -7 plus the article by RABBIT. Thanks.

I still need help.

My Combo Box on the main form is called cboArtist

Column Count = 2
Bound Column = 1

Control Source = Unbound
Row Source Type = Table/Query
Row Source:
展开 | 选择 | Wrap | 行号


我冒昧,我正在编辑你的帖子,包括[CODE]标签,重新格式化您的SQL代码(仅用于视觉显示 - 不改变效果)。


您会更容易注意到现在,每个第2行的字段[ArtitstName]拼写错误。


在UNION查询中,字段名称始终由第一个查询确定,因此后续查询即'用它来联合,没关系 - 即使它在那里拼写正确。


对于你的代码破解(在第3行显示)我也不能帮助就像我无法获得大部分信息一样。我没有关于qryCD或BuildFilter的信息。


我可以说,不是改变.RecordSource,而是简单地设置.Filter本身和调用.ReQuery。你在第6行上的.ReQuery对我来说也是错的。它是需要重新获取的表单而不是子表单控件(可以包含子表单)。
I took the liberty, while I was editing your post to include the [ CODE ] tags, of reformatting your SQL code too (just for visual display - not to change the effect).

You will notice more easily now that the field [ArtitstName] on line #2 of each is misspelled.

In a UNION query, the field name is ALWAYS determined by the first query, so the subsequent query that''s UNIONed with it, doesn''t matter - even though it is spelt correctly there.

For your code breaking (at line #3 shown) I can''t help too much as most of the information is not available to me. I have no info about qryCD or BuildFilter.

What I can say though, is that rather than changing the .RecordSource, it''s probably easier simply to set the .Filter itself and call a .ReQuery. The .ReQuery you have on line #6 seems wrong to me too. It is the form that needs to be requeried and not the subform control (which can contain a subform).
展开 | 选择 | Wrap | 行号


这篇关于组合框不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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