Error: Microsoft JET Database Engine

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a VB.NET WINFORM project with MS Access as database. The
database has 2 tables:

1) PROJID: has the following fields: projid & projnm, projid is the primary
key
2) PROJCOST: has the following fields: projid, currtyp, costtyp, yr, annamt.
Primary keys are: projid, currtyp, costtyp, yr.

In the MS Access Relationships design for this database, I setup a
relationship between PROJID & PROJCOST tables related by 'projid' field and
the 'Enforce Referential Integrity' box is checked.

On one window form, I created a dataview populated with data from table
PROJID. Several text box fields on this form are binded to this dataview,
user can change data in table PROJID from these text fields.

To save data to table, I use DataAdapter.Update command. This is where I
keep getting an error saying:

"Error: Microsoft JET Database Engine: The record cannot be deleted or
changed because table 'projcost' includes related records"

This happen even when the primary key field in PROJID is not changed. Please
let me know if you have way to solve this problem

Thanks
 
Hi David,

Does your code make Access 'think' it is saving a new projid data? eg,
'change currtyp to 'B' and change projid to 99873' (which is already was)?

Bernie Yaeger
 
Hi Bernie,

Thanks for your response.

In the debug mode, I use the dataset.HasChanges() method to check for rows
that have added, deleted, modified DATAROWSTATE. With dataset.GetChanges()
method I found only rows that were modified. In each of these rows, only the
non-primary key fields were modified. So no new projid was added to table.

DavidT
 
Hi David,

Sorry, I don't know what to suggest. My guess is that the checking of the
referential integrity box is what is causing your problem, but I'm not sure.
Did you try posting to an MS Access ng?

Bernie
 
Back
Top