如何在选项组访问 VBA 中获取单选按钮的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23275708/
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
How to get a value of radio button in the option group Access VBA
提问by vuyy1182
I've an Access 2010 form that contains 2 radio buttons. One for Yesand one for Noin Option Group. How do I get the selected value?
我有一个包含 2 个单选按钮的 Access 2010 表单。一个是和一个没有在选项组。我如何获得选定的值?
i.e. - whether user selected Yes or No, using VBA.
即 - 用户是否选择是或否,使用 VBA。
回答by PowerUser
Option Groups return an integer value starting at 1 and going up from there. If your option group is called Fld_Opt_Method then try Me.Fld_Opt_Method
:
选项组返回一个整数值,从 1 开始并从那里向上。如果您的选项组被称为 Fld_Opt_Method 然后尝试Me.Fld_Opt_Method
:
If Me.Fld_Opt_Method = 1 Then msgbox "first option"
If Me.Fld_Opt_Method = 2 Then msgbox "second option"
If Me.Fld_Opt_Method = 1 Then msgbox "first option"
If Me.Fld_Opt_Method = 2 Then msgbox "second option"