Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access: Err 2342 in SQL SELECT Statement in VBA

51 views
Skip to first unread message

Suzanne Shepard

unread,
Apr 17, 2003, 5:09:35 PM4/17/03
to
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

Perry

unread,
Apr 20, 2003, 7:29:28 AM4/20/03
to
RunSQL performs an actionquery or a definitionquery.
SQL statements starting with
Insert Into
Update
Select Into
Delete
...etc
Look it up in the VBA online help
or look here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/ht
ml/output/F1/D2/S5A1F8.asp

Y're following statement is no action or deifintionquery


> strSQL = "SELECT tblTable.* FROM tblTable;"

if the records of tblTable have to be shown,
use
DoCmd.OpenTable "tblTable", acViewNormal

Krgrds,
Perry

"Suzanne Shepard" <sshe...@hartforddirect.com> schreef in bericht
news:013401c30525$a60af290$a601...@phx.gbl...

0 new messages