C
Chewie via AccessMonster.com
I am trying to create a recordset, based on a filtered form. The problem
seems to be that rst.filter doesn't accept a form's filter. Code example :
Public Function TestMe()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = DBEngine(0)(0)
Set rst = dbs.OpenRecordset(Form_Name.RecordSource, dbOpenSnapshot)
rst.Filter = Form_Name.Filter
rst.Sort = Form_Name.OrderBy
Set rst = rst.OpenRecordset()
'==> ERROR
End Function
? TestMe
? err.Number
3061
? err.Description
Too few parameters. The expected number is: 2.
? Form_Name.Filter
((tblTable.Field="Content"))
? Form_Name.OrderBy
tblTable.Field DESC
The same problems persists with the rst.Sort method. It's not possible to
create the form with a query already assigned as recordsource. It should
be a table that is filtered. Is there any way to create a "real" filtered
and ordered recordsource from a form ?
seems to be that rst.filter doesn't accept a form's filter. Code example :
Public Function TestMe()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = DBEngine(0)(0)
Set rst = dbs.OpenRecordset(Form_Name.RecordSource, dbOpenSnapshot)
rst.Filter = Form_Name.Filter
rst.Sort = Form_Name.OrderBy
Set rst = rst.OpenRecordset()
'==> ERROR
End Function
? TestMe
? err.Number
3061
? err.Description
Too few parameters. The expected number is: 2.
? Form_Name.Filter
((tblTable.Field="Content"))
? Form_Name.OrderBy
tblTable.Field DESC
The same problems persists with the rst.Sort method. It's not possible to
create the form with a query already assigned as recordsource. It should
be a table that is filtered. Is there any way to create a "real" filtered
and ordered recordsource from a form ?