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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"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
|
|||
|
|||
"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
|
|||
|
|||
"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 | |
|
|
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 |