Link to home
Start Free TrialLog in
Avatar of Shanan212
Shanan212Flag for Canada

asked on

Too Few Parameters. Expected 2

- Hi, before posting here, I have done by research. According to different solutions to this error, my code looks good.

When this code is run, the form is open (where variable is derived) and populated. The table "INTER" exists under 'Tables'
The same code worked upto this point > & " AND TCOMBI.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS, dbFailOnError

Open in new window


After adding extra variable (above) the code stopped working and gave me the error. Upon the error, a quote was automatically added to the end of the statement (I didn't add it but I suspect this is the culprit)

CurrentDb.Execute "SELECT INTER.OTCOMBO 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


Any help is much appreciated!
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shanan212

ASKER

Ow that worked to eliminate one error. Now its giving me too few parameters: Expected 1

Thanks!
Able to solve 1 error
When you reference a form control, it must be a full reference:

CurrentDb.Execute "SELECT INTER.OTCOMBO 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

 termcombo is not a full reference.  Must be something like:

  Forms![<form name>]![termcombo]

  Just like your other one for servicecombo.

Jim.