MS Access Forms:如何在组合框中动态更改选择选项?
我的MS Access窗体有两个组合框,c1
和c2
.
My MS Access form has a two combo boxes, c1
and c2
.
我需要c2
中的select options
进行动态更改. . .当我在c1
中选择一个选项时.我怎样才能做到这一点 ?
I need the select options
in c2
to change dynamically . . . when i select an option in c1
. How can I do this ?
c1
中的每个值与c2
中的多个值匹配.因此,如果在c1
中选择Mike
,则c2
应该仅提供与Mike
相对应的那些选项.现在,combo box c2
显示所有选项.
Each value in c1
matches multiple values in c2
. So if I select Mike
in c1
, the c2
should provide only those options that correspond to Mike
. Right now combo box c2
shows ALL options.
如何根据c1
中选择的内容来限制c2
中的选项?
How can I restrict the options in c2
based on what was selected in c1
?
谢谢!!!
使用C1中的AfterUpdate事件并更新C2的rowSource 像这样:
use the AfterUpdate event from C1 and update the rowSource for C2 something like:
Private Sub c1_AfterUpdate()
Dim iVal As String
iVal = Nz(Me.c1.value, "")
Dim S As String
S = "SELECT Field from myTable where Field like '" & iVal & "'"
Me.c2.RowSource = S
'Optionally me.C2.Requery
End Sub