且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从父窗体中选择的值填充子窗体中的列表框

更新时间:2023-12-06 12:55:04

参见参考子表单上的项目,然后考虑在问题中包含更多信息以获取更详细的帮助。我甚至不确定你的问题究竟是什么。
See Referring to Items on a Sub-Form for that bit and then consider including more information in the question for more detailed help. I''m not even sure from your question what you''re after exactly.


说我有父表单:FormA有一个列表框:lst1,它有几行说显示人名。

当选择此列表中的一行时,它应填充一个列表框:子窗体上的lst2:FormB,带有相关数据,说明所选人员的子项。

我实际把子窗体放在FormA的页面上,比如PageA1。


我想我应该使用查询来填充lst2.rowsource,选择子窗口= lst1.value。


我认为lst2.rowsource中查询的语法是:
Say I have the parent form: FormA that has a listbox: lst1 and it has a few rows say displaying people''s names.
When a row in this list is selected, it should populate a listbox: lst2 on the subform: FormB, with relevant data, say the selected person''s children.
I put the subform on a page of FormA actually, say PageA1.

I suppose I should populate lst2.rowsource with query that selects the children where parent = lst1.value.

I suppose the syntax of the query in lst2.rowsource is:
展开 | 选择 | Wrap | 行号


这是一个更清晰的工作:-)


我现在的问题是,在试图解释你已经找到了相当好的答案你提出的一切。再好。


您可能希望了解另一种方法。在用于lst2的RowSource的SQL中,您可以在FormA.lst1的 AfterUpdate 事件过程中使用代码中内置的字符串文字。然后,如果lst1的值是Murphy,你最终会得到类似的东西:

That''s a much clearer job :-)

My problem now is that in attempting to explain you have found correct answers to pretty well everything you asked. Good again.

There is an alternative approach that you may wish to be aware of though. In the SQL used for the RowSource of lst2 you could use a string literal built within your code in the AfterUpdate event procedure of FormA.lst1. Then, if the Value of lst1 were "Murphy", you would end up with something like :

展开 | 选择 | 换行 | 行号