我得到的,我在Excel VBA是新「沒有爲一個或多個必需的參數給定值」的值,請建議什麼是錯的查詢,下面是代碼我正在使用從基於訪問數據獲取值,我想在運行時擁有表名稱和表列名稱。錯誤沒有爲一個或多個必需的參數給出VBA
Dim con As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim name As String
Dim count As Integer
Dim FindString As String
Dim FindString1 As String
Dim SQLQuery As String
FindString = InputBox("Enter the table name")
FindString1 = InputBox("Enter search value")
count = 4
Dim strConn As String
Set con = New ADODB.Connectioncon.Mode = adModeReadWrite
If con.State = adStateClosed Then
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & "databasepath\Database3.accdb;Persist Security Info=False;"
con.ConnectionString = strConn
con.Open
Set rs.ActiveConnection = con
End If
SQLQuery = "select * from " & FindString & " where " & FindString & ".[LOGO] ='" & FindString1 & "'"
rs.Open的SQLQuery
http://stackoverflow.com/questions/6034959/open-recordset-in-access-2003-2007 –
http://msdn.microsoft.com/en-us/library/windows/桌面/ ms675544%28v = vs.85%29.aspx –
您可以發佈您的完整代碼嗎?或者至少是這個片段所屬的'Sub'例程? :) – Manhattan