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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL-How do I use a stored query with parameters

Status
Not open for further replies.

doneg

Programmer
Jul 20, 1999
7
US
I am attempting to use stored queries with parameters but I cannot seem to get it to work. I have already created the query with the visdata program. If I try to open the query directly as a recordset it responds with a not enough parameters error.<br>
<br>
How do I set a reference to the query before attempting to open the recordset?<br>
<br>
All of the examples of parameter queries I can find all create the queries on the fly and then delete them when done.<br>
<br>
Again, thanks in advance for any help.
 
Not enough paramaters means there may be a problem with the syntax.<br>
Put a stop line (F9) just before you pass the SQL to it<br>
like so:<br>
---------------------------------<br>
Dim db as database, rst as recordset, SQL as string<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = &quot;SELECT * FROM Orders WHERE OrderDate &gt;= #1-1-95#;&quot;<br>
debug.print SQL <br>
Set rst = db.OpenRecordset(SQL) '&lt;&lt;&lt;&lt; Put a stop line here<br>
------------------<br>
<br>
Then look carefully at your SQL statement to make sure everything is correct.<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Doug,<br>
Thanks for the reply, unfortunately (or fortunately) I got this working after making the post.<br>
<br>
Thanks again,<br>
Don<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top