I have a subform in the main form. I have a recordset as well (Access 2007).
I want to display the records in the recordset in the subform. So I wrote this.
(The recordset is fetching value correctly, I have checked that) However, this throws run-time error (
)
I had another way which worked. The code was like this.
In this case, I also had to define an Access query in the name of
, though I had to define that once again in the code here (don't know why!!).
Therefore, I wanted to know if there is any way to do it in the first way (using recordset object).
I want to display the records in the recordset in the subform. So I wrote this.
Code:
Set subfrmResourceProposedInProject.Form.Recordset = rst
run-time error '2467': The expression you entered refers to an object that is closed or doesn't exist
I had another way which worked. The code was like this.
Code:
strQueryName = "SELECT * FROM tbl_Emp_Master;"
Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs("qry_All_Emp_Detail")
qdf.SQL = strQueryName
subfrmCustomerExpense.SourceObject = "Query.qry_All_Emp_Detail"
qry_All_Emp_Det ail
Therefore, I wanted to know if there is any way to do it in the first way (using recordset object).
Comment