Results 1 to 2 of 2

Thread: Using the 'SELECT...IN' function to query a recordset?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    70

    Cool

    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!!

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Australia
    Posts
    69
    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.
    Live long and prosper...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width