Wrox Programmer Forums
|
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2007, 06:11 AM
Authorized User
 
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to pushpa
Default runtime-error 2342

What is wrong with this code?
I'm using Access 2K and
I keep getting the error "runtime Error 2342 A runsql action requires an argument consisting of an SQL statment"

Private Sub Command9_Click()
Dim strSQL As String
strSQL = "SELECT * FROM table;"
DoCmd.RunSQL (strSQL)
End Sub

I also get the same error


 
Old May 21st, 2007, 10:43 AM
Wrox Author
 
Join Date: May 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The SQL in the RunSQL method cannot be a SELECT statement. This method is used to run an action or DDL query, such as UPDATE, DELETE, or CREATE TABLE. To retrieve records using a SELECT statement you'll need to use a Recordset object.

Hope this help,

Rob Cooper
Lead Software Design Engineer in Test
Microsoft Access Team

co-author: Access 2007 VBA Programmer's Reference

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at microsoft.com/info/cpyright.htm.





Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
runtime error dhoward VB.NET 2002/2003 Basics 2 November 1st, 2007 03:30 PM
runtime error??? jeffreyJS ASP.NET 2.0 Basics 4 September 14th, 2006 04:07 AM
Runtime Error whiterainbow ASP.NET 2.0 Professional 2 September 12th, 2006 01:20 AM
mysterious error runtime error '451' coyotworks Excel VBA 1 May 12th, 2006 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.