You should assign the Select SQL to a recordset to run it.
I do not think it is possible to just set the SQL to the array, you could set it to the individual Array elements using an "Or" statement or and "And" statement.
The SQL and VBA recordset are extremely particular about the Syntax of the SQL statement.
To get it right it is ussually best to break it up on separate lines so that you can build it up when testing.
Here is two examples of the VBA to open a recordset with one and two where statement.
Dim SQL As String
On Error GoTo Eventerror
zeroes = "000000": year = Format(Date, "yyyy"): month = Format(Date, "mm")
SQL = "SELECT Que_CallNumber.* " & _
"FROM Que_CallNumber " & _
"WHERE DealerCode = " & Me.Dealercode
Set rs = CurrentDb.OpenRecordset(SQL)
Exit Sub
Eventerror:
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Descri
ption
this for more than one
SQL = "SELECT LabourRates.* " & _
"FROM LabourRates " & _
"WHERE Date1 <= #" & Format(Me.Date, "mm/dd/yyyy") & "#" & _
"And Date2 > #" & Format(Me.Date, "mm/dd/yyyy") & "#"
Set rs = CurrentDb.OpenRecordset(SQL)
er = rs.EndUserRate
rs.Close
Set rs = Nothing
I also found this code for working with an SQL Server
Dim rsCustomer As ADODB.Recordset
Set rsCustomer = New ADODB.Recordset
rsCustomer.Open "SELECT BI FROM FichaCandidatura WHERE BI ='" & Me.BI & "'", CurrentProject.Connection, adOpenStatic, adLockOptimistic
txtCustomerNo = rsCustomer.Fields("BI")
rsCustomer.Close