SQL -- VBA

J

Jeanne

Receive RunTime error ‘2342’
A RunSQL action requires an argument consisting on an SQL statement.

I’m able to run other SQL successfully, Insert, Delete, … cannot run a
Select statement.

I have this same below code running in other applications – no problem.
In this same application I have an SQL Select statement running using this
same Recordset definition -- no problem
My “References†in Tools include “Microsoft ActiveX DataObjects 2.1 Library.

Dim cnn2 As ADODB.Connection
Set cnn2 = CurrentProject.Connection
Dim RcdSet2 As New ADODB.Recordset
RcdSet2.ActiveConnection = cnn2

Dim sSQL As String

sSQL = "SELECT COA_Checking.* FROM COA_Checking"
DoCmd.RunSQL sSQL
 
J

Jeanne

Dan,

Looked at your attachment, unable to look at the code in the link.

Trying not to be redundant, but I have successfully run the below code many
times. Suddenly, it will NOT work for a particular form I created.
I have the exact code (different SQL) in another place within the same
Access DB.
I don't understand the sudden issue.
Just for the record, my level and reference for the code is Access for
Dummies book. It's been fine up to now.
 
J

John Spencer

RunSQL REQUIRES an action query. A SELECT query is not an action query as it
does nothing to modify the data in the database.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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