Can someone please help me to find the errors in my code. I've used the following code:
Private Function AddAllToList(C As Control, Id As Long, Row As _Long, Col As Long, Code As Integer) As Variant
Static DB As DAO.Database, RS As DAO.Recordset
Dim PRm As Parameter
Dim Qdf As QueryDef
' Open the recordset defined in the RowSource property.
Set DB = DBEngine.Workspaces(0).Databases(0)
Set Qdf = DB.QueryDefs(C.RowSource)
For Each PRm In Qdf.Parameters
PRm.Value = Eval(PRm.Name)
Next PRm
Set RS = Qdf.OpenRecordset(dbOpenSnapshot)
The Rowsource property is set to:
SELECT [qryFilt_Markets].Idnummer, [qryFilt_Markets].Markets FROM _[qryFilt_Markets]
Unfortunately I get a Error message that says:
Item not found in collection!
Hopefully somenone knows why this error occurs
Thanks in advance!
Private Function AddAllToList(C As Control, Id As Long, Row As _Long, Col As Long, Code As Integer) As Variant
Static DB As DAO.Database, RS As DAO.Recordset
Dim PRm As Parameter
Dim Qdf As QueryDef
' Open the recordset defined in the RowSource property.
Set DB = DBEngine.Workspaces(0).Databases(0)
Set Qdf = DB.QueryDefs(C.RowSource)
For Each PRm In Qdf.Parameters
PRm.Value = Eval(PRm.Name)
Next PRm
Set RS = Qdf.OpenRecordset(dbOpenSnapshot)
The Rowsource property is set to:
SELECT [qryFilt_Markets].Idnummer, [qryFilt_Markets].Markets FROM _[qryFilt_Markets]
Unfortunately I get a Error message that says:
Item not found in collection!
Hopefully somenone knows why this error occurs
Thanks in advance!