Domanda

i am trying to have my code update a column in my validation table when the ID value in another table is even but i keep getting a syntax error, and from what i can tell from all the examples ive seen online its right (apparently not, but it looks right). The syntax error gets thrown on the where statement part of the code, does anyone see something that I dont?

DoCmd.RunSQL "UPDATE OTCValidation LEFT JOIN Option16 ON Option16.[Plan Code]=OTCValidation.[Plan Code] SET OTCValidation.[Step 1 Actual]= Option16.[RXOTCIND] WHERE Option16.ID % 2 = 0 AND OTCValidation.[Plan Code] is not Null"
DoCmd.RunSQL "UPDATE OTCValidation LEFT JOIN Option16 ON Option16.[Plan Code]=OTCValidation.[Plan Code] SET OTCValidation.[Step 2 Actual]= Option16.[RXOTCIND] WHERE Option16.ID % 2 <> 0 AND OTCValidation.[Plan Code] is not Null"
È stato utile?

Soluzione

Access uses the Mod keyword as the modulus operator.

DoCmd.RunSQL "UPDATE OTCValidation LEFT JOIN Option16 ON Option16.[Plan Code]=OTCValidation.[Plan Code] SET OTCValidation.[Step 1 Actual]= Option16.[RXOTCIND] WHERE Option16.ID Mod 2 = 0 AND OTCValidation.[Plan Code] is not Null"
DoCmd.RunSQL "UPDATE OTCValidation LEFT JOIN Option16 ON Option16.[Plan Code]=OTCValidation.[Plan Code] SET OTCValidation.[Step 2 Actual]= Option16.[RXOTCIND] WHERE Option16.ID Mod 2 <> 0 AND OTCValidation.[Plan Code] is not Null"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top