?
Solved

Too Few Parameters. Expected 1

Posted on 2011-09-15
11
Medium Priority
?
240 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1600 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
 
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 400 total points
ID: 36543375
Or should TCOMBI.SERVICE be INTER.SERVICE?

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

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1600 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

850 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