Click to See Complete Forum and Search --> : DAO Recordset. Needs resetting?


April 30th, 1999, 12:05 PM
Hi all. I'm using VC++ 6 with CDaoRecordset in a Dialog based project to access MS Access query which returns part numbers and descriptions of products. I'm using the Find member function to search by part number, which works great. The trouble is when I do a wildcard search by description. Descriptions are CString's and the code looks like this:

UpdateData(TRUE);
CString str;
str.Format("[ItemDescription] Like '%s*'", m_Set.m_ItemDescription);
m_Set.FindFirst(str);
UpdateDataData(FALSE);

The problem is that it works great for the first search but it doesn't work anymore after that without closing and restating the program. I tried calling MoveFirst to go back to the top of the recordset and I also tried calling Close() then Open() but nothing seems to work. Any help is greatly appreciated.

May 1st, 1999, 02:42 AM
Hi,

try using the following:

while( m_Set.FindNext( str ) != 0 )
{
etc.
}

hope this helps,

Daniel