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