Solved

Too Few Parameters. Expected 1

Posted on 2011-09-15
11
200 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
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)

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help writing a query 6 73
Sub Reports 8 23
MS Access Calculation wont work 5 36
Would like Regex to return a string array with no duplicates. 3 28
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

895 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

21 Experts available now in Live!

Get 1:1 Help Now