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

Forms reference in dbs.OpenRecordset method

Status
Not open for further replies.

purpledawn

Programmer
Jun 21, 2001
50
US
I know this has a real simple solution, but I can't figure it out.

I am trying to create a recordset using a saved query.

thequery = "qry_OrgForm_OrgName"

Set rst = dbs.OpenRecordset(thequery)


When I run the code using no or static 'criteria' in the query, everything works fine. But when the 'criteria' in the query refers to the text box value in a opened Form (which is my objective), I get a response saying that there are too few parameters. I think that this means that there is a syntax error in the Forms reference. But when I run the same query (refering to the textbox) from the Query Design window, it works fine!

Does anyone have any ideas about what's going on?

 
Try the Eval() function. I finally found out about and it saves me numerous headaches.
For example, use the following for your criteria in the saved query;
Eval("[Forms]![frmMyForm]![txtTextBox]")
Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top