根据另一个结果填充一个下拉列表 [英] Populating One Dropdown based on the Results of Another
问题描述
小组,
我很难理解以前关于
这个主题的一些帖子所以我想写下我的内容我试过了,希望你可以
帮助我排除故障。我有一个从桌子填充的下拉菜单,我想要选择并使用它来填充下一个下拉菜单。
到目前为止:
>
1)我尝试使用一个查询来说明从
specific_issue中选择特定问题并用作我的标准[表格]![报告]![问题类别]
但这似乎没有填充第二次下拉列表。 (Rowsource类型是
查询)
2)我尝试使用第一个组合框的On Exit命令来使用它
填充第二个组合框的语句
([OtherCombo] .RowSource ="从YourTableName中选择AttendYear
YourTableName.Event ="& Me.ThisComboName)
3)我也点击了Access中的每一个按钮
所有帮助将不胜感激,
提前致谢,
Melih
我原本预计#2会工作。 #1会起作用,但你必须向第二个组合框发出一个
Requery。在#2中,由于你要更改
RowSource,组合框应该自动重新查询。
例如:
我。 OtherCombo.Requery
一个可能的问题,如果组合框与它所绑定的字段名称相同,那么你的代码有点模棱两可。尝试将#2更改为
Me.OtherCombo.RowSource ="从YourTableName中选择AttendYear
YourTableName.Event =" &安培;我。这个ComboName& ""
此外,Me.ThisComboName返回的值是多少?它是一个数字
还是一个文本字符串?语法对于一个数字是正确的,如果它是一个文本
字符串,将上面的行修改为:
Me.OtherCombo.RowSource ="选择从YourTableName参加表格
YourTableName.Event =""" &安培;我。这个ComboName& """;"
-
Wayne Morgan
MS Access MVP
< me *********** @ gmail.com>在消息中写道
news:11 ********************** @ g44g2000cwa.googlegr oups.com ...小组,
我很难理解以前关于这个主题的一些帖子,所以我想写下我曾尝试过的东西并希望你可以帮助我排除故障。我有一个从表格填充的下拉列表,我想要选择并使用它来填充下一个下拉列表。
到目前为止:
1)我尝试使用查询那就是从
specific_issue中选择具体问题并用作我的标准[表格]![报告]![问题类别]
但似乎没有填充第二个下拉列表。 (Rowsource类型是
查询)
2)我尝试了第一个组合框的On Exit命令,使用这个
语句来填充第二个组合框
([OtherCombo] .RowSource ="从YourTableName中选择AttendYear
YourTableName.Event ="& Me.ThisComboName)
3)我也点击了Access中的每个按钮
所有帮助将不胜感激,
提前致谢,
Melih
韦恩&小组,
我再次尝试了你的解决方案。我得到的错误说它找不到我用来获取数据的宏。
。我认为这个错误让我感到困惑,因为我并不认为我在使用宏。感谢
你的帮助,
Melih
Wayne Morgan写道:我原本预计#2会起作用。 #1会起作用,但你必须向第二个组合框发出一个
Requery。在#2中,由于你要更改
RowSource,组合框应该自动重新查询。
例如:
Me.OtherCombo.Requery
一个可能的问题,如果组合框与它绑定的字段具有相同的名称,那么您的代码有点模棱两可。尝试将#2更改为
Me.OtherCombo.RowSource ="从YourTableName中选择AttendYear
YourTableName.Event =" &安培;我。这个ComboName& ""
此外,Me.ThisComboName返回的值是多少?它是一个数字
还是一个文本字符串?语法对于一个数字是正确的,如果它是一个文本
字符串,将上面的行修改为:
Me.OtherCombo.RowSource ="从YourTableName中选择AttendYear
YourTableName.Event =""" &安培;我。这个ComboName& """"
-
Wayne Morgan
MS Access MVP
< me ******* ****@gmail.com>在消息中写道
新闻:11 ********************** @ g44g2000cwa.googlegr oups.com ...小组,
我很难理解以前关于这个主题的一些帖子,所以我想写一些我尝试过的东西,希望你能
帮我排除故障。我有一个从表格填充的下拉列表,我想要选择并使用它来填充下一个下拉列表。
到目前为止:
1)我尝试使用查询那就是从
specific_issue中选择具体问题并用作我的标准[表格]![报告]![问题类别]
但似乎没有填充第二个下拉列表。 (Rowsource类型是
查询)
2)我尝试了第一个组合框的On Exit命令,使用这个
语句来填充第二个组合框
([OtherCombo] .RowSource ="从YourTableName中选择AttendYear
YourTableName.Event ="& Me.ThisComboName)
3)我也点击了Access中的每个按钮
所有帮助将不胜感激,
提前致谢,
Melih
Wayne&小组,
我再次尝试了你的解决方案。我得到的错误说它找不到我用来获取数据的宏。
。我认为这个错误让我感到困惑,因为我并不认为我在使用宏。感谢
你的帮助,
Melih
Wayne Morgan写道:我原本预计#2会起作用。 #1会起作用,但你必须向第二个组合框发出一个
Requery。在#2中,由于你要更改
RowSource,组合框应该自动重新查询。
例如:
Me.OtherCombo.Requery
一个可能的问题,如果组合框与它绑定的字段具有相同的名称,那么您的代码有点模棱两可。尝试将#2更改为
Me.OtherCombo.RowSource ="从YourTableName中选择AttendYear
YourTableName.Event =" &安培;我。这个ComboName& ""
此外,Me.ThisComboName返回的值是多少?它是一个数字
还是一个文本字符串?语法对于一个数字是正确的,如果它是一个文本
字符串,将上面的行修改为:
Me.OtherCombo.RowSource ="从YourTableName中选择AttendYear
YourTableName.Event =""" &安培;我。这个ComboName& """"
-
Wayne Morgan
MS Access MVP
< me ******* ****@gmail.com>在消息中写道
新闻:11 ********************** @ g44g2000cwa.googlegr oups.com ...小组,
我很难理解以前关于这个主题的一些帖子,所以我想写一些我尝试过的东西,希望你能
帮我排除故障。我有一个从表格填充的下拉列表,我想要选择并使用它来填充下一个下拉列表。
到目前为止:
1)我尝试使用查询那就是从
specific_issue中选择具体问题并用作我的标准[表格]![报告]![问题类别]
但似乎没有填充第二个下拉列表。 (Rowsource类型是
查询)
2)我尝试了第一个组合框的On Exit命令,使用这个
语句来填充第二个组合框
([OtherCombo] .RowSource ="从YourTableName中选择AttendYear
YourTableName.Event ="& Me.ThisComboName)
3)我也点击了Access中的每个按钮
所有帮助将不胜感激,
提前致谢,
Melih
Group,
I''m having a tough time understanding some of the previous posts on
this topic so I wanted to write what I''ve tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:
1) I tried using a query that said select specificissue from
specific_issue and used as my criterion [Form]![Report]![IssueCategory]
but that didn''t seem to populate the 2nd dropdown. (Rowsource type was
query)
2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName)
3)I''ve also clicked every button in Access
All help will be appreciated,
Thanks in advance,
Melih
I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.
Example:
Me.OtherCombo.Requery
One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName & ";"
Also, what is the value being returned by Me.ThisComboName? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = """ & Me.ThisComboName & """;"
--
Wayne Morgan
MS Access MVP
<me***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...Group,
I''m having a tough time understanding some of the previous posts on
this topic so I wanted to write what I''ve tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:
1) I tried using a query that said select specificissue from
specific_issue and used as my criterion [Form]![Report]![IssueCategory]
but that didn''t seem to populate the 2nd dropdown. (Rowsource type was
query)
2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName)
3)I''ve also clicked every button in Access
All help will be appreciated,
Thanks in advance,
Melih
Wayne & Group,
I tried your solution again. The error I get says that it can''t find
the macro that I''m using to get the data. The error I think is what''s
confusing me because I didn''t think I was using a macro. Thanks for
your help,
Melih
Wayne Morgan wrote:I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.
Example:
Me.OtherCombo.Requery
One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName & ";"
Also, what is the value being returned by Me.ThisComboName? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = """ & Me.ThisComboName & """;"
--
Wayne Morgan
MS Access MVP
<me***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...Group,
I''m having a tough time understanding some of the previous posts on
this topic so I wanted to write what I''ve tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:
1) I tried using a query that said select specificissue from
specific_issue and used as my criterion [Form]![Report]![IssueCategory]
but that didn''t seem to populate the 2nd dropdown. (Rowsource type was
query)
2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName)
3)I''ve also clicked every button in Access
All help will be appreciated,
Thanks in advance,
Melih
Wayne & Group,
I tried your solution again. The error I get says that it can''t find
the macro that I''m using to get the data. The error I think is what''s
confusing me because I didn''t think I was using a macro. Thanks for
your help,
Melih
Wayne Morgan wrote:I would have expected #2 to work. #1 will work, but you have to issue a
Requery to the second combo box. In #2, since you are changing the
RowSource, the combo box should automatically requery.
Example:
Me.OtherCombo.Requery
One possible problem, if the combo box has the same name as the field it is
bound to, your code is a little ambiguous. Try changing #2 to
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName & ";"
Also, what is the value being returned by Me.ThisComboName? Is it a number
or a text string? The syntax is correct for a number, if it is a text
string, modify the above line to:
Me.OtherCombo.RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = """ & Me.ThisComboName & """;"
--
Wayne Morgan
MS Access MVP
<me***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...Group,
I''m having a tough time understanding some of the previous posts on
this topic so I wanted to write what I''ve tried and hope that you can
help me troubleshoot. I have a dropdown populated from a table and I
want to take that selection and use it to populate the next dropdown.
So far:
1) I tried using a query that said select specificissue from
specific_issue and used as my criterion [Form]![Report]![IssueCategory]
but that didn''t seem to populate the 2nd dropdown. (Rowsource type was
query)
2) I tried on the On Exit command of the first combo box to use this
statement to populate the second combo box
([OtherCombo].RowSource = "Select AttendYear from YourTableName Where
YourTableName.Event = " & Me.ThisComboName)
3)I''ve also clicked every button in Access
All help will be appreciated,
Thanks in advance,
Melih
这篇关于根据另一个结果填充一个下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!