troubleshooting Question

How to Insert, Delete records/Fiels into a CDatabase MS Access database using CString- MFC

Avatar of LarryAMillsSr
LarryAMillsSr asked on
Microsoft Access
7 Comments1 Solution967 ViewsLast Modified:
I am having trouble adding records into my MS Access DB. In debug I can see that the recordset is loaded but I get an exception error when I try to do AddNew. here's the code I'm using:(m_pSet is the recordset)
BOOL CDispatcherView::RecordAdd(void)
      {
      // If already in add mode, then complete previous new record
      m_pSet->TestData(m_pSet->m_ID+1);
      if (m_bIsAddMode)
            {
            OnMove(ID_RECORD_FIRST);//ID_RECORD_LAST  
            //OnMove(ID_RECORD_LAST);//ID_RECORD_LAST      ID_RECORD_NEXT      
            }
      OnGetRecordset()->AddNew();
      m_bIsAddMode = TRUE;
      UpdateData(FALSE);
      return TRUE;
      }
The error is "Attempt to update or delete failed"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros