
Access: Err 2342 in SQL SELECT Statement in VBA
I never tried performing a SELECT with the "docmd"
approach. I always define a recordset object, a database
object, and the use the SELECT sql string. The syntax
looks something like this,although I can't be sure this
early in the morning:
DB_object.Recorset_Object(SQL_string)
Quote:
>-----Original Message-----
>I am creating a new Access 2002 database using VBA to
>select and update records. I have many existing such
>databases that are working fine.
>Anytime I create a new SELECT statement using VBA & SQL I
>get the following error:
>Run-time error '2342':
>A RunSQL action requires an argument consisting os an SQL
>statement.
>This ONLY happens on SELECT statements. The following
>code runs:
>strSQL = "DELETE tblTable.* FROM tblTable;"
>DoCmd.RunSQL (strSQL)
>This generates an error:
>strSQL = "SELECT tblTable.* FROM tblTable;"
>DoCmd.RunSQL (strSQL)
>Any help would be appreciated.
>Thanks,
>Suzanne
>..
>.