Click to See Complete Forum and Search --> : Filtering in table type Recordset


April 20th, 1999, 05:13 PM
I am trying to filter a table type recordset in following way (directly call to DAO)
First derive a class CMyDatabase from CDaoDatabase, then add function SetFilter as follows (I am really not sure it's right or not):
void CMyDatabase::SetFilter(LPCTSTR szTable, LPCTSTR szFilter)
{
DAORecordset* pDAORecordset = NULL;
if (m_pDAORecordsets == NULL)
InitWorkspace();

try
{
DAO_CHECK(m_pDAORecordsets->get_Item(COleVariant(szTable, VT_BSTRT), &pDAORecordset));
DAO_CHECK(pDAORecordset->put_Filter(COleVariant(szFilter, VT_BSTRT).bstrVal));
}
... ...
}
The problem is m_pDAORecordsets is allways NULL. Can anyone help me out?
Thanks.