1

I am getting "No value given for one or more required parameters", I am new in Excel VBA, Please suggest what is wrong with the query, Below is the code I am using to get the value from a access data based and I want to have the table name and the table column name on runtime.

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

Community
  • 1
  • 1
user3103991
  • 407
  • 1
  • 8
  • 13

1 Answers1

-1

Looks like a problem with this SQL query.

"select * from " & FindString & " where [Resolution] = '" & FindString1 & "'"

I would suggest to make an extra step like this.

Dim SQLQuery as String
SQLQuery = "select * from [" & FindString & "] where [Resolution] = '" & FindString1 & "'"
rs.Open SQLQuery

Maybe you can have a look at this solution too.

No value given for one or more required parameters visual basic error

Community
  • 1
  • 1