Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Too Few Parameters. Expected 2

Posted on 2011-09-14
4
Medium Priority
?
322 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 1500 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 58
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

772 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