A family of Microsoft relational database management systems designed for ease of use.
That is my more or less my response. Once you declare the qry variable yu should be able to treat it the same as typing out the full name everywhere.
Obviously it is more direct to just open the recordset using the query name. But this isn't my code, so I am hesitant to eliminate the qry variable in case it is used someplae else. And sisnce I can't tell what is happening I will create a form and make its recordset the same as the one being manipulated, so the results show on the form, or in a listbox on a form.
Fro example:
Set qdf = CurrentDb.QueryDefs("qyDataSelection")
qdf.Parameters(0) = [Forms]![DataSelectionForm]![txtbxPart]
qdf.Parameters(1) = [Forms]![DataSelectionForm]![txtbxLocation]
qdf.Parameters(2) = [Forms]![DataSelectionForm]![txtbxTest]
qdf.Parameters(3) = [Forms]![DataSelectionForm]![txtSartDate]
qdf.Parameters(4) = [Forms]![DataSelectionForm]![txtEndDate]
' For Each prm In qdf.Parameters
' prm = Eval(prm.Name)
' Next prm
Set rst = qdf.OpenRecordset
===========================
I came up with this becasueI could not figure out waht eval(parm.name) meant, and withthe parms buried in the loop, I could not examine them.
Now I just put the parameter definitions (the control names) in the qry def for qryDataSelection. And the control names themselvs may be the result of other queries.
I know this all sounds crazy, but it was one of situations where the requirements were unknown at the beginning, and things were added piecemeal over time, without the under lying data relationships to support them: hence the constant stream of Dlookups.
Anyway, inthe one case neither the construct
Set rst = qdf.OpenRecordset nor
Set rst = dbs.OpenRecordset("qyDataSelection" seems to work, even though the query operates manually, and all my other queries work this way.
Maybe I need a pause statement or something??????