Solved

DAO Update() problem

Posted on 1998-01-22
3
290 Views
Last Modified: 2013-11-20
I am trying to use DAO to add a new record with the AddNew()
and Update() functions using DDX.  I get an exception error #
3265 that says "Item not found in this collection".  Database was
created with Access 7.0 for Win95.  Coding in VC++ 4.0.
Please help!!!
0
Comment
Question by:descott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:dhodge
ID: 1314588
You must check that the fields are bound correctly, go into class wizard and re-bind the variables.

Secondly if you are using a non-default sql statement just check to see if the fields you're expecting to modified are present in the sql.
0
 

Author Comment

by:descott
ID: 1314589
I tried his suggestions to no avail.  Note that I can read and delete
records without a problem.

Here is my code:

CTestSet::CTestSet(CDaoDatabase* pdb)
      : CDaoRecordset(pdb)
{
      //{{AFX_FIELD_INIT(CTestSet)
      m_Id = 0;
      m_nFields = 1;
      //}}AFX_FIELD_INIT
      m_nDefaultType = dbOpenDynaset;
}

CString CTestSet::GetDefaultDBName()
{
return _T("E:\\projects\\DrScott\\drscott.mdb");
}

CString CTestSet::GetDefaultSQL()
{
      return _T("[Test]");
}

void CTestSet::DoFieldExchange(CDaoFieldExchange* pFX)
{
      //{{AFX_FIELD_MAP(CTestSet)
      pFX->SetFieldType(CDaoFieldExchange::outputColumn);
      DFX_Short(pFX, _T("[Id]"), m_Id);
      //}}AFX_FIELD_MAP
}

CTestSet *Set = new CTestSet(NULL);
Set->Open();
Set->AddNew();
Set->m_Id = 4;
Set->Update();
Set->Close();
delete Set;

The update causes an exception # 3265 "Item not found in this
collection"

Thanx alot in advance
Dave Scott
de-scott@mindspring.com

0
 
LVL 2

Accepted Solution

by:
dhodge earned 50 total points
ID: 1314590
Clutching at straws now, but I always find that its a good idea to try and problems out in Access first.  This will rule out any silly errors like the user doesn't have update / add authority on the db.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question