Runtime Error: 2342. "A RunSQL action requires an argument consist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

of an SQL statement"

Hello, I cannot figure out what is wrong with the code below. I keep getting the above runtime error. But it runs no problem in Desiqn Query mode, once I've set the primary keys for the two tables. Any idea what the problem is?

Dim strSQL As String
strSQL = "SELECT zmax2.*, rooting2.* " & _
"FROM zmax2 LEFT JOIN rooting2 " & _
"ON zmax2.musym = rooting2.musym"

'Turn off warning message.
DoCmd.SetWarnings False

DoCmd.RunSQL strSQL

'Re-enable warning message
DoCmd.SetWarnings True

RichardA
 
RunSql requires an action query - DELETE, APPEND, UPDATE, ...

A SELECT query is NOT an action query. What are you trying to accomplish with
this code? Open a recordset? Display a query?
 
RunSQL can only be used to run an *Action* Query (Append / Update / Delete),
and NOT a Select Query.

--
HTH
Van T. Dinh
MVP (Access)


RichardA said:
of an SQL statement"

Hello, I cannot figure out what is wrong with the code below. I keep
getting the above runtime error. But it runs no problem in Desiqn Query
mode, once I've set the primary keys for the two tables. Any idea what the
problem is?
 
Thanks John. You are right. My overall goal is to fill a new, empty column in zmax2 with a calculation based on the minimum of two other columns, one from zmax2,
the other from rooting2.

RichardA
 
Thanks Van. You are right. My overall goal is to fill a new, empty column in zmax2 with a calculation based on the minimum of two other columns, one from zmax2,
the other from rooting2.

RichardA
 
Back
Top