This tutorial explains how to use Access VBA DoCmd.RunSQL Method command and cause of Error 2342 (due to using non-action query such as Select statement)
Access VBA DoCmd.RunSQL Method and Error 2342
DoCmd.RunSQL Method runs specified SQL statement. The SQL statement can only be action query (such as create table, modifying data), but not Select statement.
Syntax of DoCmd.RunSQL Method
DoCmd.RunSQL(SQLStatement, UseTransaction)
SQLStatement
A string expression that's a valid SQL st...
Read More