descott
asked on
DAO Update() problem
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!!!
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!!!
ASKER
I tried his suggestions to no avail. Note that I can read and delete
records without a problem.
Here is my code:
CTestSet::CTestSet(CDaoDat abase* pdb)
: CDaoRecordset(pdb)
{
//{{AFX_FIELD_INIT(CTestSe t)
m_Id = 0;
m_nFields = 1;
//}}AFX_FIELD_INIT
m_nDefaultType = dbOpenDynaset;
}
CString CTestSet::GetDefaultDBName ()
{
return _T("E:\\projects\\DrScott\ \drscott.m db");
}
CString CTestSet::GetDefaultSQL()
{
return _T("[Test]");
}
void CTestSet::DoFieldExchange( CDaoFieldE xchange* pFX)
{
//{{AFX_FIELD_MAP(CTestSet )
pFX->SetFieldType(CDaoFiel dExchange: :outputCol umn);
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
records without a problem.
Here is my code:
CTestSet::CTestSet(CDaoDat
: CDaoRecordset(pdb)
{
//{{AFX_FIELD_INIT(CTestSe
m_Id = 0;
m_nFields = 1;
//}}AFX_FIELD_INIT
m_nDefaultType = dbOpenDynaset;
}
CString CTestSet::GetDefaultDBName
{
return _T("E:\\projects\\DrScott\
}
CString CTestSet::GetDefaultSQL()
{
return _T("[Test]");
}
void CTestSet::DoFieldExchange(
{
//{{AFX_FIELD_MAP(CTestSet
pFX->SetFieldType(CDaoFiel
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.