Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 June 20th, 2005, 01:45 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default Too few parameters. 1 expected !!!

I am trying to run an SQL Query in VB access but I keep on getting this message -- Too few parameters. 1 expected. I tested the SQL in a query and it works fine. What is it I am missing ? Can anyone help me please.

Chantal
 
Old June 20th, 2005, 03:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Please post your SQL so we can read it.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old June 21st, 2005, 08:00 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

I recommend you set up your VB code something like this:

SQL = the sql statement
Debug.Print SQL
DoCmd.RunSQL SQL

The Immediate Window will have the exact SQL statement that is executed. If you can copy the SQL from the Immediate Window into a query and run that successfully, there is something really, really wrong. My bet is that the sql statement that you think you're running in VB isn't the same as the one you tested in a query.

Primarily, your problem is likely to be that the sql statement has quotes in it and in VB you'll have to double-up or triple-up the quotes to get the correct SQL syntax.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org





Similar Threads
Thread Thread Starter Forum Replies Last Post
update stt- Too few parameters. Expected 1. s_sanks Classic ASP Databases 0 March 7th, 2008 08:03 AM
too few parameters expected 1 jim11 Access VBA 1 December 7th, 2005 03:41 PM
too few parameters expected n desprate Access VBA 6 April 29th, 2005 06:33 AM
Error "Too Few Parameters - Expected 1" timmaher Access VBA 2 August 31st, 2004 04:04 AM
Too few parameters. Expected 1. harry_barry Classic ASP Databases 2 May 26th, 2004 04:12 PM





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