WHERE IN Query with two recordsets in Access VBA

后端 未结 1 802
死守一世寂寞
死守一世寂寞 2021-01-17 00:41

My first post here, so i hope this is the right area. I am currently trying to compare 2 recordsets, one of which has come from an Excel named range, and the other from a ta

1条回答
  •  伪装坚强ぢ
    2021-01-17 00:52

    You can compare data from two different sources in one query. You can either use the IN keyword in SQL or, more simply, link to the Excel table (sheet) in Access and build your query around that.

    EDIT an example using IN

    SELECT * FROM  CompareTable 
    LEFT JOIN
       (SELECT * FROM [Sheet1$]  
        IN ''[Excel 8.0;HDR=YES;IMEX=2;DATABASE=C:\Full\Path\AndName.xls]) C
    ON CompareTable.CourseKey=c.CourseKey
    WHERE c.CourseKey Is Null
    

    Sheet1$ can also be Named_Range.

    0 讨论(0)
提交回复
热议问题