Reputation: 520
Are there any articles or other form of information regarding ways to retrieve/ compare datas from fields with records that can contain multiple values ?
As suggested on this post I am trying to replace my way-to-long code by an SQL statement but I can't manage to make it run :
Dim SQL As String
SQL = "UPDATE 12Dec " _
& "Set [WPRC Part] = 'YES' " _
& "WHERE " _
& "12Dec.PartNo.value in (SELECT SparePartNo FROM WPRC_Parts_List) " _
& "OR 12Dec.PartNo.value in (SELECT SerialPartNo FROM WPRC_Parts_List) "
DoCmd.RunSQL SQL
In the above code:
Upvotes: 1
Views: 563
Reputation: 43595
Your code produces this SQL:
UPDATE 12Dec Set [WPRC Part] = 'YES' WHERE 12Dec.PartNo.value in (SELECT SparePartNo FROM WPRC_Parts_List) OR 12Dec.PartNo.value in (SELECT SerialPartNo FROM WPRC_Parts_List)
Are you sure that 12Dec.PartNo.value
is column name? Take a look here:
http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_in
Upvotes: 1