在Access 2007中,我正在搜索某個表以找到某個ID。 ID地址由用戶IDTxt在文本框中給出。
我得到錯誤80040e10沒有值的一個或多個參數。正在搜索某個表以找到某個ID:錯誤80040e10對於一個或多個參數沒有值
Private Sub Search_Click()
'here a new part I'm not sure about...
Dim cn As ADODB.Connection
Dim rsQ As ADODB.Recordset
Set cn = CurrentProject.Connection
Set rsQ = New ADODB.Recordset
Dim strSQL As String
Dim ID_number As Integer
Dim blnExists As Boolean
blnExists = False
ID_number = IDTxt.Value
strSQL = "SELECT * FROM Table1 WHERE ID = ID_number;"
rsQ.Open strSQL, cn, adOpenStatic
If rsQ.RecordCount <> 0 Then
' Found it
blnExists = True
MsgBox "found"
Else
MsgBox "not found"
End If
End Sub
@@ Aya Abdelsalam:請不要忘記註冊並接受幫助您的答案。 –
@@ Aya Abdelsalam:如果答案對您有幫助,請接受其中一項。 –