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

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
 
J

John Spencer (MVP)

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?
 
V

Van T. Dinh

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?
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top