A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Too Few Paramters"?



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2006, 02:24 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default "Too Few Paramters"?


What's wrong with this? It gives me: "Too few parameters. Expected 1."
and the debugger points to the currentDB.Execute(query)
-- snip --


CodeBox.SetFocus
code = Str(CodeBox.Text)
DescBox.SetFocus
desc = DescBox.Text

query = "INSERT INTO ExpCode(Code, Description) VALUES(" + code + "," +
desc + ");"

MsgBox query

CurrentDb.Execute (query)

-- snip --

  #2  
Old March 15th, 2006, 02:37 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default "Too Few Paramters"?

What happens if you remove the parentheses from around "query"?

CurrentDb.Execute query

Also, you are using the plus sign for concatenation. This will work in most
cases, but can cause problems. Try using the ampersand (&) instead unless
you are using the + for a "special effect". There are times that the + does
have an advantage, but it is when doing more than just concatenating.

--
Wayne Morgan
MS Access MVP


wrote in message
oups.com...

What's wrong with this? It gives me: "Too few parameters. Expected 1."
and the debugger points to the currentDB.Execute(query)
-- snip --


CodeBox.SetFocus
code = Str(CodeBox.Text)
DescBox.SetFocus
desc = DescBox.Text

query = "INSERT INTO ExpCode(Code, Description) VALUES(" + code + "," +
desc + ");"

MsgBox query

CurrentDb.Execute (query)

-- snip --



  #3  
Old March 15th, 2006, 02:53 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default "Too Few Paramters"?

What do you see in the msgbox? You can use debug.Print query so your query
is printed in the immediate window.

You don't need to SetFocus. Just use the Value property (or even omit the
..Value or .Text).

I expect your issue is that your code might work if both fields were
numeric. Assuming they are both text, try:

code = Str(Me.CodeBox)
desc = Me.DescBox
query = "INSERT INTO ExpCode(Code, Description) " & _
"VALUES(""" & code & """,""" & desc & """);"

MsgBox query
Debug.Print query
CurrentDb.Execute query

--
Duane Hookom
MS Access MVP
--

wrote in message
oups.com...

What's wrong with this? It gives me: "Too few parameters. Expected 1."
and the debugger points to the currentDB.Execute(query)
-- snip --


CodeBox.SetFocus
code = Str(CodeBox.Text)
DescBox.SetFocus
desc = DescBox.Text

query = "INSERT INTO ExpCode(Code, Description) VALUES(" + code + "," +
desc + ");"

MsgBox query

CurrentDb.Execute (query)

-- snip --



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm getting a "Too many cell formats" error. Victoria_in_NY General Discussion 2 January 27th, 2006 08:52 PM
Queries that are "too wide" Rich General Discussion 6 January 9th, 2006 06:04 PM
Error: "too many different cell formats" Vlookup help General Discussion 3 January 5th, 2006 02:49 PM
How do I stop the "Too many different cell formats" ? bebz Worksheet Functions 1 January 1st, 2006 03:24 PM
How do I solve "too many different cell formats" in Excel 2003 Brettjg General Discussion 1 December 12th, 2005 03:13 PM


All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.