Are you trying to allow the user to type in several quote values, all right under each other, and have the query show the data for each of those quote values?
You can try something similar to this:
'This code takes a range and puts the values into a common delimited string
Dim cell As Range
Dim values As String
For Each cell In Range("A8:A10")
values = values & "'" & cell & "', "
Next
values = Left(values, Len(values) - 2)
'This code updates the query with the values
With Selection.QueryTable
.Connection = Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\db1.mdb;DefaultDir=C:\;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _
))
.CommandText = Array( _
"SELECT `CATERPILLAR-PRICES-2009 Query`.Field1, `CATERPILLAR-PRICES-2009 Query`.Field2, `CATERPILLAR-PRICES-2009 Query`.Field3, `CATERPILLAR-PRICES-2009 Query`.Field4" & Chr(13) & "" & Chr(10) & "FROM `CATERPILLAR-PRICES-2009 Que" _
, _
"ry` `CATERPILLAR-PRICES-2009 Query`" & Chr(13) & "" & Chr(10) & "WHERE (`CATERPILLAR-PRICES-2009 Query`.Field1 IN (" & values & "))" _
)
.Refresh BackgroundQuery:=False
End With
The first part of the code will take a range of cells and produce a string that stores all the values in one place. When you run the code, the values variable should store something that looks like this:
'Quote1', 'Quote2', 'Quote3'
Of course, instead of Quote1, it will be the first value the user typed in.
The second part of the code is exactly the same as the code I previously posted with the exception of the WHERE clause. In my original code, I used a where clause of Field1 = 'Quote'... In the code I just posted, the WHERE clause will look like this:
Field1 IN ('Quote1', 'Quote2', 'Quote3')
This will return all the records where Field1 is one of the three values.
I don't know how many values the users will enter, so you may need to change the range. If you use named ranges, then you can simply put the name in the Range function and just update the named ranges to include additional values.
Let me know how it works or if you run into any issues.