访问表单加载 vba 时的空组合框值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21993579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:51:16  来源:igfitidea点击:

Empty combobox values when access form loads vba

vbaaccess-vba

提问by vuyy1182

I want to empty the combobox every time when form loads. Using the below code

每次加载表单时,我都想清空组合框。使用下面的代码

   Private Sub Form_Load()

   combo1.RowSource = ""

   End Sub

But Combobax is not emptying.

但 Combobax 并没有清空。

回答by HelloW

Your code is setting the rowsource of the combo box not the value. The combo box can be cleared by setting the value directly.

您的代码正在设置组合框的行源而不是值。可以通过直接设置值来清除组合框。

Private Sub Form_Load()

combo1 = ""

End Sub

回答by Mike Cannon

Recommend you clear using the following:

建议您使用以下方法清除:

Me.comboBoxName.RowSource = ""

Me.comboBoxName.RowSource = ""

Me.comboBoxName = ""

Me.comboBoxName = ""