自动填充组合框
我又来了。 我的表单上有 3 个组合框,即 cmbPart_number、cmbPart_name 和 cmbEOnumber。
我想知道的是,当用户从 cmbPart_number 中进行选择时,如何自动填充 cmbPart_name 和 cmbEO_number 框。 到目前为止,我所尝试的是在行源 SQL 查询中添加part_name和EO_number,并在 cmbpart_name 的控制源中添加 cmbpart_name(value)=cmbpart_number.column(1)
对此的任何帮助都非常感谢
Here i am again. I have 3 comboboxes on my form ie cmbPart_number, cmbPart_name and cmbEOnumber.
All i want to find out is how the cmbPart_name and cmbEO_number boxes are autopopulated when the user makes a selection from the cmbPart_number. What i have tried so far is adding part_name and EO_number in the row source SQL query and in the control source of cmbpart_name i have tried cmbpart_name(value)=cmbpart_number.column(1)
Any help with this is truly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够通过在 AfterUpdate 事件中设置 RowSource 来完成此操作
以下是 在Access中实现级联组合框
You should be able to do this by setting the RowSource in the AfterUpdate event
Here's a walk through on different ways to implement cascading combo boxes in Access
我知道必须有一种简单的方法可以做到这一点,而无需深入研究 VB。 我的第一个组合框即 cmbPart_number,我已修改如下 - Row Source 在 SQL 查询中具有所有 3 个字段,即 SELECT part_number、part_name、EO_number from parts ORDER BY...;
我已将列计数修改为 2,因为 Access 始终将表中的第一列计数为数字 0。 所有 3 个字段均为 2。 我的列宽是 1";0"
接下来,我将 cmbPart_name 的控制源修改为 =cmbpart_number.column(1)。 它的行源有一个 SELECT 语句 SELECT part_number, part_name FROM parts, ORDER BY...
列数为 1,列宽为 0";1"
最后对于 cmbEO_number,控制源为 =cmbpart_number.column(2)。 行源选择语句为 SELECT part_number, EO_number FROM parts ORDER BY...列数为 1,列宽为 0";1"
现在,这可以正常工作,并且 cmbPart_number 框中选择的任何条目都会自动填充其他 2 个条目。
感谢大家的帮助。
I knew there had to be a simple way of doing this without digging deep into VB. My first combobox ie cmbPart_number, i have modified as follows - Row Source has all 3 fields in the SQL query ie SELECT part_number, part_name, EO_number from parts ORDER BY...;
I have modified the column count to 2 as Access always counts the first column in a table as number 0. So its Column 0,1 & 2 for all 3 fields. My column widths are 1";0"
Next I modified cmbPart_name's control source to read =cmbpart_number.column(1). Its row source has a SELECT statement SELECT part_number, part_name FROM parts, ORDER BY...
Column Count is 1 and Column Width is 0";1"
Finally for cmbEO_number, control source is =cmbpart_number.column(2). Row Source select statement is SELECT part_number, EO_number FROM parts ORDER BY...Column count is 1 and column width is 0";1"
This now works fine and any entry selected in the cmbPart_number box autopopulates the other 2.
Thank you all for your help.