?
Solved

DAO Update() problem

Posted on 1998-01-22
3
Medium Priority
?
293 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

764 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