deleing a records in a form

  • Thread starter Thread starter pvp
  • Start date Start date
P

pvp

Access 2002.

I have the follwoing code in a form based on a table:

"

' permit deletion just long enuf to delete then
cancel it again
Me.AllowDeletions = True

'<-- in DELETE state: add n edit n del y 116 ? -->

Application.RunCommand acCmdDeleteRecord
Me.AllowDeletions = False

'<-- in READONLY state: add n edit n del n 116 ? -
->
"

....works OK (record IS deleted) but then I get:

"you can't go to this record"

Any ideas?

Thanks.
 
pvp said:
Access 2002.

I have the follwoing code in a form based on a table:

"

' permit deletion just long enuf to delete then
cancel it again
Me.AllowDeletions = True

'<-- in DELETE state: add n edit n del y 116 ? -->

Application.RunCommand acCmdDeleteRecord
Me.AllowDeletions = False

'<-- in READONLY state: add n edit n del n 116 ? -
->
"

...works OK (record IS deleted) but then I get:

"you can't go to this record"

Any ideas?

Hi pvp,

what specific line of code raises the error? Have you stepped through
the code? One possibility is that your form attempts to return to the
record you've just deleted, which maybe you could get around by doing a
Me.Requery right after you've deleted the record.

Alternately, you could get around the issue of worrying about the
permissions the form allows by using a QueryDef to run the delete for
you. As it seems you've been getting some strange errors with your
current approach, that might be something to try.

spark
 
Back
Top