[英]MS-Access Form - Populate Input Box based on multiple List Boxes
I have a form with multiple list boxes that all pull from the same table.我有一个包含多个列表框的表单,这些列表框都来自同一个表。 I want a separate input box to populate a field from the table based on a selection from either list box.
我想要一个单独的输入框,根据从任一列表框中的选择填充表中的字段。 So if I select an item in MyListBox1 that record will display in the input box, but then if I select an item in MyListBox2, the input box will display that record instead.
因此,如果我在 MyListBox1 中选择一个项目,该记录将显示在输入框中,但是如果我在 MyListBox2 中选择一个项目,则输入框将显示该记录。
I have a general idea how to do this with 1 list box based on the .selected of the MyListBox object.我对如何使用基于 MyListBox 对象的 .selected 的 1 个列表框有一个大致的想法。 However, I'm trying to get an idea if its possible for based an Input box off the selected object's selection?
但是,我想知道是否可以将输入框基于所选对象的选择? Or last selected object if that makes sense.
或者如果有意义的话,最后选择的对象。
This seems like a really counter-intuitive interface, but assuming I've correctly understood what you are looking to achieve, I believe you would need to use an unbound Text Box which would be populated via the After Update
event of each List Box.这似乎是一个非常反直觉的界面,但假设我已经正确理解您要实现的目标,我相信您需要使用一个未绑定的文本框,该文本框将通过每个列表框的
After Update
事件填充。
For example, given two List Boxes respectively called List1
& List2
, and a Textbox called Text1
, the following simplistic event handler could be defined for each list box to populate the Text Box accordingly:例如,给定两个分别称为
List1
和List2
列表框和一个名为Text1
的文本框,可以为每个列表框定义以下简单的事件处理程序以相应地填充文本框:
Private Sub List1_AfterUpdate()
Text1 = List1
End Sub
Private Sub List2_AfterUpdate()
Text1 = List2
End Sub
Yielding the following daft behaviour:产生以下愚蠢的行为:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.