?
Solved

Too Few Parameters. Expected 1

Posted on 2011-09-15
11
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 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