Solved

Too Few Parameters. Expected 1

Posted on 2011-09-15
11
187 Views
Last Modified: 2012-05-12
CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.MIN, INTER.LTL, INTER.[500], INTER.[1M], INTER.[2M], INTER.[5M], INTER.[10M], INTER.[20M]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


Hi this question is from
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27308787.html

As I said in above thread, I've done my research and compared my statement to another statement which is working. Couldn't still figure out whats wrong with it. The form 'Point2Point' is open and the field 'servicecombo' is populated!

Thanks!
0
Comment
Question by:Shanan212
  • 4
  • 4
  • 3
11 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 400 total points
ID: 36542884
try this, copy and paste

CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.[MIN], INTER.LTL, INTER.[500], INTER.[1M], INTER.[2M], INTER.[5M], INTER.[10M], INTER.[20M] 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
0
 
LVL 13

Author Comment

by:Shanan212
ID: 36543074
There is no error when I posted that but its not making the table called 'getT' either!

0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36543106
check your where clause,

or try it without the where clause, run this one

CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.[MIN], INTER.LTL, INTER.[500], INTER.[1M], INTER.[2M], INTER.[5M], INTER.[10M], INTER.[20M] INTO getT FROM [INTER]   ORDER BY INTER.CLASS", dbFailOnError
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36543255
where is "termcombo" located ? what is the name of the form ?
0
 
LVL 13

Author Comment

by:Shanan212
ID: 36543303
The post with ID 36542884 still gives the Error 1 (I did not properly call it so I though it was running but not outputting)

termcombo is a parameter that is being passed to this function

Private Sub exgetTERM(termcombo As String)
     
    On Error GoTo EH

    CurrentDb.TableDefs.Delete ("getB")
    DoCmd.SetWarnings False
    CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.[MIN], INTER.LTL, INTER.[500], INTER.[1M], INTER.[2M], INTER.[5M], INTER.[10M], INTER.[20M] 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
    DoCmd.SetWarnings True

    Exit Sub
    
EH:
  If Err.Number = 3265 Then Resume Next
  MsgBox "error " & Err.Number & ": " & Err.Description
    
End Sub

Open in new window



Termcombo compromises of user entered strings

termc = text1&text2

Before sending termcombo to the function, I have a msgbox outputting the 'termc' to see if any values are going in (which is true since I am executing the whole thing from a Form called Point2Point which houses populated fields - text1, text2 and servicecombo boxes)

Function call is this

exgetTERM(termc)

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 61

Expert Comment

by:mbizup
ID: 36543338
Have you carefully verified that all field and table names are correct (no typos)?

That is very often the cause of this error.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36543363
You have TCOMBI.SERVICE, implying that table TCOMBI is in your query... but your FROM statement is

FROM [INTER]

This is probably the issue.  You need to include  table TCOMBI
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 100 total points
ID: 36543375
Or should TCOMBI.SERVICE be INTER.SERVICE?

Either way, TCOMBI.SERVICE is likely not being recognized.
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 400 total points
ID: 36543385
Shanan212,
i found two errors in your original code

1.  INTER.[20M]INTO getT   ' you need an space  before  "INTO"

2.  you have to place MIN in bracket, MIN is a reserved word in Access  >> INTER.[MIN]


upload a copy of the db...
0
 
LVL 13

Author Comment

by:Shanan212
ID: 36543387
Ow I saw that and corrected that and then came here and you guys are on it as well :)

It should've been "INTER.SERVICE"

It works fine!

Thank you sirs!
0
 
LVL 13

Author Closing Comment

by:Shanan212
ID: 36543395
Thanks!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 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

17 Experts available now in Live!

Get 1:1 Help Now