We help IT Professionals succeed at work.

Record/Key Deleted with access database

rossmcm
rossmcm asked
on
I have a MS Access database that I am appending records to from a D5 app.  It was working fine, then suddenly I started to get an exception "Record/Key deleted" when I was appending/posting records to it.

with Table1 do
    begin
    Append ;
    FieldValues ['Field1'] := Feild1Contents ;
    ... more fields
    Post ;
    end ;

I also get the message when I try to browse the table using a DBGrid.

I see various references to this problem on the web but the solutions either don't work or seem overblown/inappropriate to my situation.

Help!.

Any ideas ?
Comment
Watch Question

Software Developer
CERTIFIED EXPERT
Commented:
CERTIFIED EXPERT
Top Expert 2004

Commented:
didn't know if the above links also say tzhis,
but the problem is, i guess, that the record cannot realocated.

try to add a primary key to your table,
avoid autoincrement fields for doing this

meikl ;-)
Jason SwebyTechnical Director
CERTIFIED EXPERT

Commented:
Is the table based on a query? If so, then if a record has been deleted, it is possible that the query is not refreshed and so the link between the query result set and the live underlying table is wrong, because the query result has an extra record.

J.

Author

Commented:
The table is not based on a query - it is a vanilla flat database.  The curious thing is that it was working fine and then it started doing this.

More info...  I wrapped the calls to append and post in try..except blocks to hide the error and it sort of works - the records are actually added though a DBGrid connected to the table doesn't show the new records unless the app is exited and restarted, and attempting to browse the DBgrid gives the error as soon as a record has been added.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.