2
我有几个按钮的形式使用它们。每个按钮都会运行几行代码。代码中也有查询,例如“select * from table where number = 6”
现在,如果我想在表单中输入数字作为输入,我该如何去关于它。
我有几个按钮的形式使用它们。每个按钮都会运行几行代码。代码中也有查询,例如“select * from table where number = 6”
现在,如果我想在表单中输入数字作为输入,我该如何去关于它。
更新您的按钮代码来生成查询字符串:
“SELECT * FROM myTable的WHERE为mynumber =” & me.controls( “myControlName”)值
你可能会觉得有必要。确保在“myControlName”控制只允许数字/不接受空,或者在你的程序中把所有的情况下
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