Mr. Rattles
September 4th, 1999, 03:08 PM
I have two windows set up: one is derived from CDaoRecordView and the other is a tree view. Currently, when I change a field in the current recordset of the CDaoRecordView and change to a different record by pressing one of the four default movement buttons (Move First, Move Prev, Move Next, Move Last), the data is saved to the database. When I change data in the CDaoRecordView, then click an item in the tree view (which sends a message to the CDaoRecordView to show the new record), the data is not saved to the database. I've tried adding an OnKillFocus handler to save data to the database whenever the CDaoRecordView loses focus, by simply adding the lines:
if (m_pSet->CanUpdate())
m_pSet->Update();
but I get a message box telling me an Update was called without an Edit. But in my OnRecordAdd function I don't call an Edit, but I call Update and this message box doesn't pop up. How can I save changed information to the database when another window tells the CDaoRecordView to show a different record?
Thanks,
Erik
if (m_pSet->CanUpdate())
m_pSet->Update();
but I get a message box telling me an Update was called without an Edit. But in my OnRecordAdd function I don't call an Edit, but I call Update and this message box doesn't pop up. How can I save changed information to the database when another window tells the CDaoRecordView to show a different record?
Thanks,
Erik