PDA

Click to See Complete Forum and Search --> : Using the 'SELECT...IN' function to query a recordset?


JonnyCab
Oct 15th, 2000, 07:00 AM
Is it possible to using the 'IN' function to find matches in a ADO recordset?

strSQL = "INSERT INTO tblMechEst (Contract, Resource, EntryDate, Hours, Amount)" _
& "SELECT Contract, Resource, EntryDate, Hours, Sell FROM tblTemp" _
& " WHERE ResourceCode IN (" & Temp2 & ")"

Set Temp = DataEnvironment1.Connection1.Execute(strSQL, , adCmdText)
Set Temp = Nothing

Something like above code...where Temp2 is a recordset created from a previous 'SELECT.... IN' query. Temp2 has a number of records containing the one field 'ResourceCode'.

I'm really stuck on this one so any help would be appreciated!!

gerard
Oct 15th, 2000, 06:17 PM
Wouldn't you be best combining your queries into one. Temp2 would be replaced with a sub query, which would first bring back your results to be use with the in statement, it may even be faster...just an idea.