Solved

DAO Update() problem

Posted on 1998-01-22
3
275 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
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 96
substring method in java 1 130
matchUp  challenge 9 115
Not needed 13 119
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

832 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