rossmcm
asked on
Record/Key Deleted with access database
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 ?
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 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
J.
ASKER
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.
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.
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 ;-)