Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using OpenRecordset

Status
Not open for further replies.

tyedyejenn

Programmer
Jun 14, 2000
35
US
I am trying to use OpenRecordset to run my SQL statement<br><br>Set rsRepIDCheck = dbAgentPay.OpenRecordset(strSQL)<br><br>I am getting a run time error saying too few parameters.&nbsp;&nbsp;Any advice what next step should be to fix this
 
You usually get this sort of error when there is something amiss with the syntax of the SQL. Check the WHERE clause carefully, especially if you have criteria involving string comparisons.<br><br>If this is no help, post the actual SQL to this thread.<br><br>Regards,<br>Tim.
 
Well we need to see whats in your:<br>strSQL <br>string so we can tell you want &quot;too few parameters&quot; are missing.<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
strSQL = &quot;Select RepID, Password, UserAccessLevel From RepID Where RepID= strRepID And Password = strPassword&quot;<br>'using above strSql gets me a too few parameters error on the below set statement<br>'error says expecting 4<br><br><br>'Open a Recordset named RepIdCheck<br><br>Set rsRepIDCheck = dbAgentPay.OpenRecordset(strSQL)
 
Looking at your SQL, you are using strRedID and strPassword as literal criteria instead of their values. You need to substitute the values of these into the SQL string :-<br><br>strSQL = &quot;Select RepID, Password, UserAccessLevel From RepID Where RepID = '&quot; & strRepID & &quot;' And Password = '&quot; & strPassword & &quot;'&quot;<br><br>Note the apostrophies around the inserted values. These are needed since the values are strings. You could use quotes, but these must appear doubled in a string to be part of that string.(Each time you want a &quot; to appear in your string you must use &quot;&quot; which reduces the readability of your SQL).<br><br>Regards,<br>Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top