Shanan212
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'
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)
Any help is much appreciated!
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
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
Any help is much appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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]![ser vicecombo] & 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.
CurrentDb.Execute "SELECT INTER.OTCOMBO INTO getT FROM INTER WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND TCOMBI.SERVICE=" & Chr(34) & [Forms]![Point2Point]![ser
termcombo is not a full reference. Must be something like:
Forms![<form name>]![termcombo]
Just like your other one for servicecombo.
Jim.
ASKER
Thanks!