Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Too Few Parameters. Expected 1

Posted on 2011-09-15
11
Medium Priority
?
238 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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.
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 …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

609 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