HI
我有一个带有几个按钮的表单。每个按钮运行几行代码。代码中也有查询,例如“select * from table where number = 6”
现在,如果我想在表单中输入数字,我该怎么做。
- 在按钮附近添加一个未绑定的文本控件。
-
更新您的按钮代码以生成查询字符串:
"SELECT * FROM myTable WHERE myNumber =" & me.controls("myControlName").value
您可能觉得需要确保“myControlName”控件仅允许数字/不接受 null,或处理程序中的所有情况
myQuery = "SELECT * FROM myTable"
If Isnull(me.controls("myControlName").value) then
Else
If isnumeric(me.controls("myControlName").value) then
myQuery = myQuery & " WHERE myNumber =" & me.controls("myControlName").value
Else
msgBox me.controls("myControlName").value & " is not accepted"
Exit function
Endif
Endif
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)