Solved

Too Few Parameters. Expected 2

Posted on 2011-09-14
4
304 Views
Last Modified: 2012-08-13
- Hi, before posting here, I have done by research. According to different solutions to this error, my code looks good.

When this code is run, the form is open (where variable is derived) and populated. The table "INTER" exists under 'Tables'
The same code worked upto this point > & " AND TCOMBI.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS, dbFailOnError

Open in new window


After adding extra variable (above) the code stopped working and gave me the error. Upon the error, a quote was automatically added to the end of the statement (I didn't add it but I suspect this is the culprit)

CurrentDb.Execute "SELECT INTER.OTCOMBO INTO getT FROM INTER WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND TCOMBI.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS, dbFailOnError

Open in new window


Any help is much appreciated!
0
Comment
Question by:Shanan212
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36539598
Add a quote before the ",dbfailonerror":


CurrentDb.Execute "SELECT INTER.OTCOMBO INTO getT FROM INTER WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND TCOMBI.SERVICE= " & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34)  & "  ORDER BY INTER.CLASS", dbFailOnError 

Open in new window

0
 
LVL 13

Author Comment

by:Shanan212
ID: 36542735
Ow that worked to eliminate one error. Now its giving me too few parameters: Expected 1

Thanks!
0
 
LVL 13

Author Closing Comment

by:Shanan212
ID: 36542816
Able to solve 1 error
0
 
LVL 57
ID: 36543018
When you reference a form control, it must be a full reference:

CurrentDb.Execute "SELECT INTER.OTCOMBO INTO getT FROM INTER WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND TCOMBI.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS, dbFailOnError

 termcombo is not a full reference.  Must be something like:

  Forms![<form name>]![termcombo]

  Just like your other one for servicecombo.

Jim.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now