使用2个组合框记录查找 [英] Record lookup with 2 Combo boxes

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

问题描述

大家好。我在我的工作中使用现有的访问数据库,并被要求添加一些表单和查询。到目前为止我一直表现不错,但项目的最后一部分让我陷入困境。


我的问题是我正在尝试创建一个表单来查找记录关闭2个组合框中的选项。 ComboBox1是客户ID列表,ComboBox2是基于客户ID选择的产品列表。 ComboBox1来自Customers表,ComboBox2来自Requirements表。

我希望我的表单中的字段填充来自2个组合框的相应记录中的信息,即从ComboBox1中选择Customer,从ComboBox2中选择ProductID,然后将记录显示在文本框中。


我尝试将表单绑定到查询或表格但是当我这样做时这个我或者无法获得任何记录来填充字段,或者当我打开表格时我看不到任何控件。


我不太确定我做错了什么,但这非常令人沮丧。


感谢任何人帮助:)

Hi all. I working with an existing access DB at my job and have been asked to add some forms and queries. I''ve been doing well so far, but this last part of the project has got me stuck.

My question is I am trying to create a form to look up a record based off of the selections in 2 combo boxes. ComboBox1 is a list of customer ID''s and ComboBox2 is a list of products based off the selection of the customer ID. ComboBox1 is from the Customers table and ComboBox2 is from the Requirements table.

I would like the fields in my Form to populate with the information from the appropriate record based off of the 2 combo boxes, i.e. Customer is chosen from ComboBox1, ProductID is chosen from ComboBox2 and then the record appears in the textboxes.

I have tried making the form bound to a query or table but when I do this I am either not able to get any records to populate the fields or when i open in the form I can''t see any of the controls.

I''m not really sure what I''m doing wrong, but it''s pretty frustrating.

Thanks for any help :)

推荐答案

嗨!

请参阅帖子中的附件数据
Hi!
See the attached database in the post to follow


您可以使用此附加的2Combobox来选择您的记录。 COMBO1(Lname)Rowsource = SELECT [详细信息]。[CustomerID],[详细信息] [Lname] FROM详细信息;和COMBO2(CustomerID)RowSource = SELECT [Products]。[ProductID],[Products]。[CustomerID],[Products]。[ProductName] FROM Products WHERE Forms!Details!CustomerID = [Products]。[CustomerID];我有刷新按钮来查找记录中的最新数据。我希望这可以解决你的问题。

将其标记为已经回答,或者您可以要求更多说明

欢迎您!

打开$ b以下的附件




$ b
You may use this attached 2Combobox to select your records. COMBO1(Lname)Rowsource=SELECT [Details].[CustomerID], [Details][Lname] FROM Details; and COMBO2 (CustomerID) RowSource=SELECT [Products].[ProductID], [Products].[CustomerID], [Products].[ProductName] FROM Products WHERE Forms!Details!CustomerID=[Products].[CustomerID]; I have include refresh button to look for the latest data in the records. I hope this might solve your problem.
Mark it as answered incase it has or you may ask for more clarifications
You are welcome!!!
Open the attachment below
附加文件 < table cellpadding =0cellspacing =3border =0> 2CombosonForms.zip (31.1 KB,476 views)
Attached Files
2CombosonForms.zip (31.1 KB, 476 views)


嗨先生关键,谢谢你的帮助。我只有Access 2003所以我无法打开附加的数据库。
Hi Mr Key, thanks for the help. I only have Access 2003 so I am not able to open the attached DB.


这篇关于使用2个组合框记录查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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